Bug#703240: apt: pkgTagSection.Exists sometimes lies about a field being present, .Find does not
On Sun, Mar 17, 2013 at 03:26:33PM +0100, Niels Thykier wrote:
> Package: apt
> Version: 0.9.7.8
> Severity: normal
>
> Hi,
>
> There is a flaw in the handling of hash collisions in pkgTagSection's
> "Exists" method that makes the "Exists" method return true even if the
> "Tag" (field) is not present.
>
> This is visible already in the header file, tagfile.h:
>
> """
> /* This very simple hash function for the last 8 letters gives
> very good performance on the debian package files */
> inline static unsigned long AlphaHash(const char *Text, const char *End = 0)
> [...]
>
> inline bool Exists(const char* const Tag) {return AlphaIndexes[AlphaHash(Tag)] != 0;}
> """
And unfortunately, this is inline code, so if we wanted to really
fix this, we need a rebuild of the reverse dependencies, as they
won't pick up the fixed code otherwise. I propose making this
non-inline when this gets fixed.
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
Reply to: