Module Name: src Committed By: tsutsui Date: Sun Nov 12 07:55:05 UTC 2017
Modified Files: src/common/dist/zlib: inflate.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/common/dist/zlib/inflate.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/dist/zlib/inflate.c diff -u src/common/dist/zlib/inflate.c:1.5 src/common/dist/zlib/inflate.c:1.6 --- src/common/dist/zlib/inflate.c:1.5 Tue Jan 10 01:27:41 2017 +++ src/common/dist/zlib/inflate.c Sun Nov 12 07:55:05 2017 @@ -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 @@ int flush; 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 */