summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/contrib/sha256.h2
-rw-r--r--apt-pkg/makefile2
-rw-r--r--apt-pkg/pkgcachegen.cc5
-rw-r--r--apt-pkg/pkgcachegen.h2
-rw-r--r--debian/changelog15
-rw-r--r--test/libapt/hashsums_test.cc15
6 files changed, 35 insertions, 6 deletions
diff --git a/apt-pkg/contrib/sha256.h b/apt-pkg/contrib/sha256.h
index fe2b30ac2..15146c948 100644
--- a/apt-pkg/contrib/sha256.h
+++ b/apt-pkg/contrib/sha256.h
@@ -3,6 +3,6 @@
#include "sha2.h"
-#warn "This header is deprecated, please include sha2.h instead"
+#warning "This header is deprecated, please include sha2.h instead"
#endif
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index 69d6cbffd..e1f69dd65 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -26,7 +26,7 @@ SOURCE = contrib/mmap.cc contrib/error.cc contrib/strutl.cc \
contrib/cdromutl.cc contrib/crc-16.cc contrib/netrc.cc \
contrib/fileutl.cc
HEADERS = mmap.h error.h configuration.h fileutl.h cmndline.h netrc.h\
- md5.h crc-16.h cdromutl.h strutl.h sptr.h sha1.h sha2.h \
+ md5.h crc-16.h cdromutl.h strutl.h sptr.h sha1.h sha2.h sha256.h\
sha2_internal.h \
hashes.h hashsum_template.h\
macros.h weakptr.h
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 24e95f2f2..2b6d294fb 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -106,6 +106,9 @@ void pkgCacheGenerator::ReMap(void const * const oldMap, void const * const newM
if (oldMap == newMap)
return;
+ if (_config->FindB("Debug::pkgCacheGen", false))
+ std::clog << "Remaping from " << oldMap << " to " << newMap << std::endl;
+
Cache.ReMap(false);
CurrentFile += (pkgCache::PackageFile*) newMap - (pkgCache::PackageFile*) oldMap;
@@ -685,7 +688,7 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
string const &Version,
unsigned int const &Op,
unsigned int const &Type,
- map_ptrloc *OldDepLast)
+ map_ptrloc* &OldDepLast)
{
void const * const oldMap = Map.Data();
// Get a structure
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index ff198833a..c26051182 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -75,7 +75,7 @@ class pkgCacheGenerator /*{{{*/
bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
string const &Version, unsigned int const &Op,
- unsigned int const &Type, map_ptrloc *OldDepLast);
+ unsigned int const &Type, map_ptrloc* &OldDepLast);
unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
diff --git a/debian/changelog b/debian/changelog
index 9fa44c8f9..0ab11390a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,15 @@
-apt (0.8.16~exp4) UNRELEASED; urgency=low
+apt (0.8.16~exp5) UNRELEASED; urgency=low
+
+ * apt-pkg/makefile:
+ - install sha256.h compat header
+ * apt-pkg/pkgcachegen.{cc,h}:
+ - use ref-to-ptr semantic in NewDepends() to ensure that the
+ libapt does not segfault if the cache is remapped in between
+ (LP: #812862)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 29 Jul 2011 13:44:01 +0200
+
+apt (0.8.16~exp4) experimental; urgency=low
[ Julian Andres Klode ]
* apt-pkg/pkgcache.h:
@@ -28,7 +39,7 @@ apt (0.8.16~exp4) UNRELEASED; urgency=low
* apt-pkg/sourcelist.{cc,h}:
- add pkgSourceList::GetLastModifiedTime() helper
- -- Julian Andres Klode <jak@debian.org> Wed, 20 Jul 2011 16:23:55 +0200
+ -- Michael Vogt <mvo@debian.org> Thu, 28 Jul 2011 16:57:08 +0200
apt (0.8.16~exp3) experimental; urgency=low
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index ff1536718..2cb71cc38 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -135,6 +135,21 @@ int main(int argc, char** argv)
equals(argv[5], sha2.Result().Value());
}
fclose(fd);
+
+ // test HashString code
+ {
+ HashString sha2("SHA256", argv[4]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA512", argv[5]);
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+ {
+ HashString sha2("SHA256:"+string(argv[4]));
+ equals(sha2.VerifyFile(argv[1]), true);
+ }
+
return 0;
}