From dc067431b12636a63def7c07038351fd8a88aac7 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Fri, 21 Apr 2017 16:54:57 +0000 Subject: [PATCH] - if we failed to get the offset at the current continuation level, reduce it. - reset continuation level on flush Found by oss-fuzz --- src/softmagic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/softmagic.c b/src/softmagic.c index 39a2cb5a..b7d69938 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.247 2017/03/29 15:57:48 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.248 2017/04/21 16:54:57 christos Exp $") #endif /* lint */ #include "magic.h" @@ -192,6 +192,7 @@ flush: while (magindex < nmagic - 1 && magic[magindex + 1].cont_level != 0) magindex++; + cont_level = 0; continue; /* Skip to next top-level test*/ } @@ -370,6 +371,7 @@ flush: case -1: case 0: flush = 1; + cont_level--; break; default: break; -- 2.40.0