summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/lzma.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/lzma.c b/src/lib/lzma.c
index 71c016ebcd..16b6e228fb 100644
--- a/src/lib/lzma.c
+++ b/src/lib/lzma.c
@@ -29,6 +29,11 @@ size_t ulzman(const void *src, size_t srcn, void *dst, size_t dstn)
MAYBE_STATIC_BSS unsigned char scratchpad[15980];
const unsigned char *cp;
+ if (srcn < data_offset) {
+ printk(BIOS_WARNING, "lzma: Input too small.\n");
+ return 0;
+ }
+
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
/* The outSize in LZMA stream is a 64bit integer stored in little-endian
* (ref: lzma.cc@LZMACompress: put_64). To prevent accessing by