From 2238c99b61f2656efda002ea9b5d4ff049b542cf Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sat, 16 May 2015 15:18:28 -0700 Subject: [PATCH] another check on b_info in ::unpackExtent() --- src/p_unix.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_unix.cpp b/src/p_unix.cpp index 7cac7dd1..9c6fd5c2 100644 --- a/src/p_unix.cpp +++ b/src/p_unix.cpp @@ -449,13 +449,13 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo, ph.filter_cto = hdr.b_cto8; if (sz_unc == 0) { // must never happen while 0!=wanted - throwCompressedDataViolation(); + throwCantUnpack("corrupt b_info"); break; } if (sz_unc <= 0 || sz_cpr <= 0) - throwCompressedDataViolation(); + throwCantUnpack("corrupt b_info"); if (sz_cpr > sz_unc || sz_unc > (int)blocksize) - throwCompressedDataViolation(); + throwCantUnpack("corrupt b_info"); int j = blocksize + OVERHEAD - sz_cpr; fi->readx(ibuf+j, sz_cpr); @@ -493,6 +493,8 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo, // write block if (fo) fo->write(ibuf + j, sz_unc); + if (wanted < (unsigned)sz_unc) + throwCantUnpack("corrupt b_info"); wanted -= sz_unc; } }