Bug#501274: state of #501274
On Fri, Dec 12, 2008 at 10:51:34PM +0100, Gerfried Fuchs wrote:
> * Eugene V. Lyubimkin <jackyf.devel@gmail.com> [2008-12-12 22:17:42 CET]:
> > Gerfried Fuchs wrote:
> > > Yeah, that's related to building with DEB_BUILD_OPTIONS=noopt. I just
> > > tried again, building with noopt does resolve the segfault for me,
> > > building without does not. Possibly some gcc optimization bug?
> >
> > Hm... what if you try to 'valgrind apt-cache <...>' with 'noopt'-built apt, does it report
> > something suspicious?
>
> Find attached the output of both the segfaulting binary (built with
> -O2) and the non-segfaulting binary (built with -O0).
Thanks for the valgrind output! Could you please check if the attached
patch helps?
Thanks,
Michael
=== modified file 'apt-pkg/cacheiterators.h'
--- apt-pkg/cacheiterators.h 2006-12-14 11:39:29 +0000
+++ apt-pkg/cacheiterators.h 2008-12-17 21:44:22 +0000
@@ -360,7 +360,7 @@
// Iteration
void operator ++(int) {if (FileP != Owner->VerFileP) FileP = Owner->VerFileP + FileP->NextFile;};
inline void operator ++() {operator ++(0);};
- inline bool end() const {return FileP == Owner->VerFileP?true:false;};
+ inline bool end() const {return Owner == NULL || FileP == Owner->VerFileP?true:false;};
// Comparison
inline bool operator ==(const VerFileIterator &B) const {return FileP == B.FileP;};
Reply to: