Skip to content

Commit f963dc2

Browse files
authored
Fix lzma-sdk xz bug (#1521)
A use-after-free read is possible in the Xz decoder cleanup. The fix is to set a pointer to NULL so it doesn't try to dereference it and free a second time. Fixes https://issues.oss-fuzz.com/issues/384549094 This fix is also present in lzma-sdk version 18.01. Ref: https://github.com/welovegit/LZMA-SDK/blame/main/C/XzDec.c#L508
1 parent d2fa46d commit f963dc2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

libclamav/7z/XzDec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,10 @@ void MixCoder_Free(CMixCoder *p)
343343
for (i = 0; i < p->numCoders; i++)
344344
{
345345
IStateCoder *sc = &p->coders[i];
346-
if (p->alloc && sc->p)
346+
if (p->alloc && sc->p) {
347347
sc->Free(sc->p, p->alloc);
348+
sc->p = NULL;
349+
}
348350
}
349351
p->numCoders = 0;
350352
if (p->buf)

0 commit comments

Comments
 (0)