Package: libapt-pkg-dev
Version: 0.6.42.3exp1
Severity: normal
Tags: patch

  The following code should not crash, but it does:

  pkgCache::VerIterator ver;

  if(ver.end())
    ...;

  The problem is that end() doesn't check whether Owner is NULL before
dereferencing it.  The following patch fixes this crash:

--- orig/apt-pkg/cacheiterators.h
+++ mod/apt-pkg/cacheiterators.h
@@ -163,7 +163,7 @@
    // Iteration
    void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + 
Desc->NextDesc;};
    inline void operator ++() {operator ++(0);};
-   inline bool end() const {return Desc == Owner->DescP?true:false;};
+   inline bool end() const {return Owner == NULL || (Desc == 
Owner->DescP?true:false);};
    inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = 
B.Owner;};
    
    // Comparison

  Daniel

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.14-2-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages libapt-pkg-dev depends on:
ii  apt [libapt-pkg-libc6.3-6-3 0.6.42.3exp1 Advanced front-end for dpkg
ii  apt-utils                   0.6.42.3exp1 APT utility programs

libapt-pkg-dev recommends no packages.

-- no debconf information

Attachment: signature.asc
Description: Digital signature

Reply via email to