summaryrefslogtreecommitdiff
path: root/libarchive/archive_ppmd7.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_ppmd7.c')
-rw-r--r--libarchive/archive_ppmd7.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libarchive/archive_ppmd7.c b/libarchive/archive_ppmd7.c
index fe0b0318cc050..1aed922db6568 100644
--- a/libarchive/archive_ppmd7.c
+++ b/libarchive/archive_ppmd7.c
@@ -126,6 +126,11 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc)
{
if (p->Base == 0 || p->Size != size)
{
+ /* RestartModel() below assumes that p->Size >= UNIT_SIZE
+ (see the calculation of m->MinContext). */
+ if (size < UNIT_SIZE) {
+ return False;
+ }
Ppmd7_Free(p, alloc);
p->AlignOffset =
#ifdef PPMD_32BIT