libpayload: Make lzma truncation non-fatal.
If the size the lzma header claims it needs is bigger than the space we have, print a message and continue rather than erroring out. Apparently the encoder is lazy sometimes and just puts a large value there regardless of what the actual size is. This was the original intention for this code, but an outdated version of the patch ended up being submitted. BUG=chrome-os-partner:19420 TEST=Built and booted on pit. Saw the recovery screen come up where it had not before. BRANCH=None Change-Id: Ibcf7ac0fd4b65ce85377421a4ee67b82d92d29d3 Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://gerrit.chromium.org/gerrit/66235 Reviewed-by: Stefan Reinauer <reinauer@google.com> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
This commit is contained in:
parent
20b0ba479b
commit
30c628eead
1 changed files with 2 additions and 4 deletions
|
|
@ -29,10 +29,8 @@ unsigned long ulzman(const unsigned char *src, unsigned long srcn,
|
|||
|
||||
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
|
||||
memcpy(&outSize, src + LZMA_PROPERTIES_SIZE, sizeof(outSize));
|
||||
if (outSize > dstn) {
|
||||
printf("lzma: Output truncated.\n");
|
||||
return 0;
|
||||
}
|
||||
if (outSize > dstn)
|
||||
outSize = dstn;
|
||||
if (LzmaDecodeProperties(&state.Properties, properties,
|
||||
LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) {
|
||||
printf("lzma: Incorrect stream properties.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue