summaryrefslogtreecommitdiffstats
path: root/FmpDevicePkg
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-11-19 12:50:34 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-11-21 02:04:40 +0000
commite7bd0dd26db7e56aa8ca70132d6ea916ee6f3db0 (patch)
treef5ec4e330fea52c4808370a9b5839aefcabbee63 /FmpDevicePkg
parent47343af30435302c087027177613412a1a83e919 (diff)
downloadedk2-e7bd0dd26db7e56aa8ca70132d6ea916ee6f3db0.tar.gz
edk2-e7bd0dd26db7e56aa8ca70132d6ea916ee6f3db0.tar.bz2
edk2-e7bd0dd26db7e56aa8ca70132d6ea916ee6f3db0.zip
MdeModulePkg/LzmaCustomDecompressLib: catch 4GB+ uncompressed buffer sizes
The LzmaUefiDecompressGetInfo() function [MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c] currently silently truncates the UINT64 "DecodedSize" property of the compressed blob to the UINT32 "DestinationSize" output parameter. If "DecodedSize" is 0x1_0000_0100, for example, then the subsequent memory allocation (for decompression) will likely succeed (allocating 0x100 bytes only), but then the LzmaUefiDecompress() function (which re-fetches the uncompressed buffer size from the same LZMA header into a "SizeT" variable) will overwrite the buffer. Catch (DecodedSize > MAX_UINT32) in LzmaUefiDecompressGetInfo() at once. This should not be a practical limitation. (The issue cannot be fixed for 32-bit systems without spec modifications anyway, given that the "OutputSize" output parameter of EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL.ExtractSection() has type UINTN, not UINT64.) Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1816 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201119115034.12897-2-lersek@redhat.com>
Diffstat (limited to 'FmpDevicePkg')
0 files changed, 0 insertions, 0 deletions