Răsfoiți Sursa

inflate_fast: sout is already a short so ptr arith was off by one.

inflate_fast() can do either POST INC or PRE INC on its pointers walking
the memory to decompress.  Default is PRE INC.

The sout pointer offset was miscalculated in one case as the calculation
assumed sout was a char * This breaks inflate_fast() iff configured to do
POST INC.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Joakim Tjernlund 15 ani în urmă
părinte
comite
51ea3f6a45
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      lib/zlib_inflate/inffast.c

+ 1 - 1
lib/zlib_inflate/inffast.c

@@ -286,7 +286,7 @@ void inflate_fast(z_streamp strm, unsigned start)
 		    } else { /* dist == 1 or dist == 2 */
 		    } else { /* dist == 1 or dist == 2 */
 			unsigned short pat16;
 			unsigned short pat16;
 
 
-			pat16 = *(sout-2+2*OFF);
+			pat16 = *(sout-1+OFF);
 			if (dist == 1) {
 			if (dist == 1) {
 				union uu mm;
 				union uu mm;
 				/* copy one char pattern to both bytes */
 				/* copy one char pattern to both bytes */