diff options
author | Rob Landley <rob@landley.net> | 2016-04-23 05:04:37 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-04-23 05:04:37 -0500 |
commit | badd9f799eed7d7efb9357df1e931df1f422f275 (patch) | |
tree | c23343f6e9179d0087f4b248753b33a8cdee9644 | |
parent | 4b02667d8c0993f2682bb3b1fb1db57c069fa797 (diff) | |
download | toybox-badd9f799eed7d7efb9357df1e931df1f422f275.tar.gz |
Fiz bzcat segfault reported by John Regehr (bad crc didn't set error message).
-rw-r--r-- | toys/other/bzcat.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/other/bzcat.c b/toys/other/bzcat.c index fdad9a01..ff598491 100644 --- a/toys/other/bzcat.c +++ b/toys/other/bzcat.c @@ -455,9 +455,6 @@ static void burrows_wheeler_prep(struct bunzip_data *bd, struct bwdata *bw) unsigned int *dbuf = bw->dbuf; int *byteCount = bw->byteCount; - // Technically this part is preparation for the burrows-wheeler - // transform, but it's quick and convenient to do here. - // Turn byteCount into cumulative occurrence counts of 0 to n-1. jj = 0; for (ii=0; ii<256; ii++) { @@ -651,7 +648,10 @@ static char *bunzipStream(int src_fd, int dst_fd) if (!(i = start_bunzip(&bd,src_fd, 0, 0))) { i = write_bunzip_data(bd,bd->bwdata, dst_fd, 0, 0); - if (i==RETVAL_LAST_BLOCK && bd->bwdata[0].headerCRC==bd->totalCRC) i = 0; + if (i==RETVAL_LAST_BLOCK) { + if (bd->bwdata[0].headerCRC==bd->totalCRC) i = 0; + else i = RETVAL_DATA_ERROR; + } } flush_bunzip_outbuf(bd, dst_fd); |