[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#385784: aptitude: crash with basic_string::_S_construct NULL not valid [more on error]



In
	 vector<struct DpkgState> &states = PackageOps[pkg];
pkg = 0, and is of type char *.  It is created by this code further
up; note the comments in the original:

------------------------------------
	 /* dpkg sends strings like this:
	    'status:   <pkg>:  <pkg  qstate>'
	    errors look like this:
	    'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data 
	    and conffile-prompt like this
	    'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited
	    
	 */
	 char* list[5];
	 if(!TokSplitString(':', line, list, sizeof(list)/sizeof(list[0])))
	    // FIXME: dpkg sends multiline error messages sometimes (see
	    //        #374195 for a example. we should support this by
	    //        either patching dpkg to not send multiline over the
	    //        statusfd or by rewriting the code here to deal with
	    //        it. for now we just ignore it and not crash
	    continue;
	 char *pkg = list[1];
---------------------------------------------------

(gdb) p list
$2 = {0xafccf9c9 "reinstall it before attempting a removal.", 0x0, 
  0xafccf9e6 "g a removal.", 0xafccf9ee "val.", 0x0}
(gdb) ptype list
type = char *[5]
(gdb) p line
$3 = " reinstall it before attempting a removal.\000\000e is in a very bad inconsistent state - you should", '\0' <repeats 929 times>
(gdb) ptype line
type = char [1024]

So the second line has overwritten the buffer ("line"), which still
holds the tail of the first line's message.  It looks as if the
problem is that 1) the error is multiline and 2) it is not in the
multiline format that the work-around dealt with.

Is this sufficient information that I can attempt to fix up the system
producing this error, thereby making it non-trivial for me to
reproduce?

Also, as you anticipated, this probably should be reassigned to apt.

Thanks for your help.

Ross



Reply to: