diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-10-06 18:22:24 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1994-10-06 18:22:24 +0000 |
commit | c3a82ca0a60b14ba8b64809e15a816bf565977eb (patch) | |
tree | 634bbf62ce686fc596dfde36e407b80f9a336d22 /sys/kern/imgact_gzip.c | |
parent | 9949ebf656d212287d936accb7af77f5721d17f5 (diff) | |
download | src-c3a82ca0a60b14ba8b64809e15a816bf565977eb.tar.gz src-c3a82ca0a60b14ba8b64809e15a816bf565977eb.zip |
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 !
Notes
Notes:
svn path=/head/; revision=3387
Diffstat (limited to 'sys/kern/imgact_gzip.c')
-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 6d021275df84..a9a6d3aa69bf 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; |