Просмотр исходного кода

* apt-pkg/contrib/sha2_internal.cc:
- do not use the input data directly but memcpy it instead as
it could be unaligned as in the http-transport which causes
a sigbus error on sparc (Closes: #669061)

David Kalnischkies лет назад: 14
Родитель
Сommit
5149632eb5
2 измененных файлов с 11 добавлено и 3 удалено
  1. 6 2
      apt-pkg/contrib/sha2_internal.cc
  2. 5 1
      debian/changelog

+ 6 - 2
apt-pkg/contrib/sha2_internal.cc

@@ -552,7 +552,9 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
 	}
 	while (len >= SHA256_BLOCK_LENGTH) {
 		/* Process as many complete blocks as we can */
-		SHA256_Transform(context, (sha2_word32*)data);
+		sha2_byte buffer[SHA256_BLOCK_LENGTH];
+		MEMCPY_BCOPY(buffer, data, SHA256_BLOCK_LENGTH);
+		SHA256_Transform(context, (sha2_word32*)buffer);
 		context->bitcount += SHA256_BLOCK_LENGTH << 3;
 		len -= SHA256_BLOCK_LENGTH;
 		data += SHA256_BLOCK_LENGTH;
@@ -879,7 +881,9 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
 	}
 	while (len >= SHA512_BLOCK_LENGTH) {
 		/* Process as many complete blocks as we can */
-		SHA512_Transform(context, (sha2_word64*)data);
+		sha2_byte buffer[SHA512_BLOCK_LENGTH];
+		MEMCPY_BCOPY(buffer, data, SHA512_BLOCK_LENGTH);
+		SHA512_Transform(context, (sha2_word64*)buffer);
 		ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
 		len -= SHA512_BLOCK_LENGTH;
 		data += SHA512_BLOCK_LENGTH;

+ 5 - 1
debian/changelog

@@ -8,6 +8,10 @@ apt (0.9.2) unstable; urgency=low
   * apt-pkg/aptconfiguration.cc:
     - if the compressor is not installed, but we link against it's
       library accept it as a CompressionType (Closes: #669328)
+  * apt-pkg/contrib/sha2_internal.cc:
+    - do not use the input data directly but memcpy it instead as
+      it could be unaligned as in the http-transport which causes
+      a sigbus error on sparc (Closes: #669061)
 
 
   [ Malcolm Scott ]
@@ -15,7 +19,7 @@ apt (0.9.2) unstable; urgency=low
     - iterate over all pre-depends or-group member instead of looping
       endlessly over the first member in SmartUnpack (LP: #985852)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 20 Apr 2012 09:52:01 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 20 Apr 2012 09:52:21 +0200
 
 apt (0.9.1) unstable; urgency=low