Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Chris Bainbridge
On 6 April 2015 at 21:21, David Kalnischkies wrote: > > I wonder what is so special about aptdaemon that it has problems now - > so can someone please verify that this is really the problem and not > just the first thing someone stumbled over while trying to find > a culprit (no blame, it would be

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Tomasz Buchert
Hi David, ok, I get it. A rather unfortunate decision with this API, since now it is basically impossible to have a dynamic mode name (well, it is doable but one has to manage memory outside the class itself). +1 for your patch, anyway. :) Tomasz signature.asc Description: Digital signature

Processed: Re: Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Debian Bug Tracking System
Processing control commands: > fixed -1 1.1~exp4 Bug #781858 [apt] apt: dangling pointer crash Marked as fixed in versions apt/1.1~exp4. -- 781858: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=781858 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems -- To UNSUBSCRIBE,

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread David Kalnischkies
Control: fixed -1 1.1~exp4 Hi, On Mon, Apr 06, 2015 at 03:44:01PM +0200, Tomasz Buchert wrote: > :D Of course! I focused so much on not breaking API & ABI, that I forgot > about it. The problem, which is also why this got a FIXME instead of a fix back then is that you not only have the problem o

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Tomasz Buchert
On 06/04/15 14:04, Chris Bainbridge wrote: > [...] > > In which case using strdup to create a new string for each assignment > will leak memory? > :D Of course! I focused so much on not breaking API & ABI, that I forgot about it. Stupid me! Another patch attached. Tomasz From c45e7f6a2065a5127dcf

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Tomasz Buchert
On 06/04/15 14:04, Chris Bainbridge wrote: > [...] > > In which case using strdup to create a new string for each assignment > will leak memory? :D Of course! I focused so much on not breaking ABI & API that I forgot about this... Another try is attached. Tomasz From c45e7f6a2065a5127dcff9f9b5f12

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Chris Bainbridge
On 6 April 2015 at 13:46, Tomasz Buchert wrote: > This should do the trick. > > Tomasz >From browsing the code it appears Mode can be assigned to multiple times for the same Item, e.g. { Mode = "copy"; ... Mode = decompProg.c_str() } In which case using strdup to create a new string for each as

Bug#781858: apt: dangling pointer crash

2015-04-06 Thread Tomasz Buchert
This should do the trick. Tomasz From 9b568120c6e5a0e6361271de0440b4974a0bb7df Mon Sep 17 00:00:00 2001 From: Tomasz Buchert Date: Mon, 6 Apr 2015 14:38:45 +0200 Subject: [PATCH] Fix Mode use --- apt-pkg/acquire-item.cc | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-

Bug#781858: apt: dangling pointer crash

2015-04-03 Thread Chris Bainbridge
Package: apt Version: 1.0.9.7 Severity: serious Dear Maintainer, The apt source includes in apt-pkg/acquire-item.cc: // FIXME: this points to a c++ string that goes out of scope Mode = decompProg.c_str(); } Mode is a char ptr decompProg is a std::string When decompProg goes o