diff options
author | phk <phk@FreeBSD.org> | 1994-10-06 18:22:24 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1994-10-06 18:22:24 +0000 |
commit | 52abae43776d64498863715f55944ad7e31b48f3 (patch) | |
tree | 634bbf62ce686fc596dfde36e407b80f9a336d22 | |
parent | 04c54e6dff68331efdbbd9d902cfafb612f32ff0 (diff) | |
download | FreeBSD-src-52abae43776d64498863715f55944ad7e31b48f3.zip FreeBSD-src-52abae43776d64498863715f55944ad7e31b48f3.tar.gz |
Steven Wallace provided a program which broke this stuff. I guess there are
more weird kinds of a.out than anyone can argue for. This code failed to
load the first 28K of the text-segment, in the case where the first page
of the a.out contains only the a.out-header, and the text is still at 0x0.
Thanks Steven !
-rw-r--r-- | sys/kern/imgact_gzip.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/imgact_gzip.c b/sys/kern/imgact_gzip.c index 6d02127..a9a6d3a 100644 --- a/sys/kern/imgact_gzip.c +++ b/sys/kern/imgact_gzip.c @@ -7,7 +7,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: imgact_gzip.c,v 1.4 1994/10/04 06:51:42 phk Exp $ + * $Id: imgact_gzip.c,v 1.5 1994/10/05 00:58:33 phk Exp $ * * This module handles execution of a.out files which have been run through * "gzip -9". @@ -389,6 +389,13 @@ Flush(struct gzip *gz,u_long siz) } } } + /* Skip over zero-padded first PAGE if needed */ + if(gz->output < gz->file_offset && (gz->output+siz) > gz->file_offset) { + i = min(siz, gz->file_offset - gz->output); + gz->output += i; + p += i; + siz -= i; + } if(gz->output >= gz->file_offset && gz->output < gz->file_end) { i = min(siz, gz->file_end - gz->output); q = (u_char*) gz->virtual_offset + gz->output - gz->file_offset; |