Piggy loader: Fix output buf size for LZMA decompr
commit 3be7654eaa6289e08bc2bd4d58d02f344d61ab73 fixed
lzmaBuffToBuffDecompress such that it behaves as intended by upstream
U-Boot: It now interprets the second argument *uncompressedSize as the
size of the output buffer. Previously, it just ignored this value and
potentially overran the output buffer. However, because this value did
not play a role, the piggy loader passed in some uninitialized value. If
this value turns out to be smaller than the size of the uncompressed
U-Boot image, the decompression will stop pre-maturely. To add to this
misery, the piggy loader would not check the return value of
lzmaBuffToBuffDecompress() but instead run some franken image which
could be the leftover of some previous image.
This change passes in the correct size of the output buffer, checks the
return value of lzmaBuffToBuffDecompress() and hangs if it failed.
1 file changed