summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-22 22:31:38 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-22 22:31:38 +0000
commit7f9ca7c4d29183ad1cdb99080095e1354c7946fe (patch)
tree8bfc5f46fecaa5b4000aae2ad5b5c4e95ca99a03 /chrome/installer
parent6424115c000ba3270d382fcf3dd30f205b2388ad (diff)
downloadchromium_src-7f9ca7c4d29183ad1cdb99080095e1354c7946fe.zip
chromium_src-7f9ca7c4d29183ad1cdb99080095e1354c7946fe.tar.gz
chromium_src-7f9ca7c4d29183ad1cdb99080095e1354c7946fe.tar.bz2
Emergency goobsdiff patch: don't use LZMA_RUN after LZMA_FINISH.
In testing, cases were discovered where fread would read until EOF, but lzma_code would not be able to decompress that entire block in one call because not enough space was available in the output buffer. Calling lzma_code with LZMA_FINISH followed by LZMA_RUN is incorrect. Once LZMA_FINISH is used once, subsequent calls to lzma_code must also use LZMA_FINISH. From <lzma/base.h>: * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH, * the same `action' must is used until lzma_code() returns LZMA_STREAM_END. * Also, the amount of input (that is, strm->avail_in) must not be modified * by the application until lzma_code() returns LZMA_STREAM_END. Changing the * `action' or modifying the amount of input will make lzma_code() return * LZMA_PROG_ERROR. This bug caused goobspatch to exit prematurely with a message like goobspatch: xzread(extra, 216): 11 11 is LZMA_PROG_ERROR. BUG=47199 TEST=none Review URL: http://codereview.chromium.org/2875008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/mac/third_party/bsdiff/goobspatch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/chrome/installer/mac/third_party/bsdiff/goobspatch.c b/chrome/installer/mac/third_party/bsdiff/goobspatch.c
index 385b081..5287825 100644
--- a/chrome/installer/mac/third_party/bsdiff/goobspatch.c
+++ b/chrome/installer/mac/third_party/bsdiff/goobspatch.c
@@ -194,9 +194,6 @@ static size_t xzread(xzfile *xzf, u_char *buf, size_t len, lzma_ret *err)
return 0;
} else if (feof(xzf->f)) {
xzf->eof = 1;
- /* LZMA_FINISH is not critical because
- * LZMA_CONCATENATED is not in use. */
- action = LZMA_FINISH;
}
}
@@ -211,6 +208,11 @@ static size_t xzread(xzfile *xzf, u_char *buf, size_t len, lzma_ret *err)
return 0;
}
+ /* LZMA_FINISH is not critical because
+ * LZMA_CONCATENATED is not in use. */
+ if (xzf->eof)
+ action = LZMA_FINISH;
+
/* Run the decoder. */
xzf->err = lzma_code(&xzf->ls, action);
if (xzf->err == LZMA_STREAM_END) {