Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/dist/zlib Restore a local change (in rev1.4) that was...



details:   https://anonhg.NetBSD.org/src/rev/339df56372cd
branches:  trunk
changeset: 827770:339df56372cd
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Nov 12 07:55:05 2017 +0000

description:
Restore a local change (in rev1.4) that was lost on zlib 1.12.10 merge.

The rev 1.4 changelog:
> Disable a sanity check output buffer != NULL in _STANDALONE case.
> Some kernels are loaded at address 0x0 by bootloaders and
> output buffer address could be zero in such case.
>
> Fixes "read text" errors on loading install floppy of NetBSD/news68k 4.0,
> reported by KIYOHARA Takashi on port-news68k.

This problem may also affect other m68k ports which use a gzipped install
kernel and kernel text address located at PA 0x0.

Should be pulled up to netbsd-8.

diffstat:

 common/dist/zlib/inflate.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r a1af100163e0 -r 339df56372cd common/dist/zlib/inflate.c
--- a/common/dist/zlib/inflate.c        Sun Nov 12 05:11:36 2017 +0000
+++ b/common/dist/zlib/inflate.c        Sun Nov 12 07:55:05 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inflate.c,v 1.5 2017/01/10 01:27:41 christos Exp $     */
+/*     $NetBSD: inflate.c,v 1.6 2017/11/12 07:55:05 tsutsui Exp $      */
 
 /* inflate.c -- zlib decompression
  * Copyright (C) 1995-2016 Mark Adler
@@ -644,9 +644,16 @@
     static const unsigned short order[19] = /* permutation of code lengths */
         {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 
+#if defined(__NetBSD__) && defined(_STANDALONE)
+    /* Some kernels are loaded at address 0x0 so strm->next_out could be NULL */
+    if (inflateStateCheck(strm) ||
+        (strm->next_in == Z_NULL && strm->avail_in != 0))
+        return Z_STREAM_ERROR;
+#else
     if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
         (strm->next_in == Z_NULL && strm->avail_in != 0))
         return Z_STREAM_ERROR;
+#endif
 
     state = (struct inflate_state FAR *)strm->state;
     if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */



Home | Main Index | Thread Index | Old Index