]> granicus.if.org Git - file/commitdiff
- if we failed to get the offset at the current continuation level, reduce it.
authorChristos Zoulas <christos@zoulas.com>
Fri, 21 Apr 2017 16:54:57 +0000 (16:54 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 21 Apr 2017 16:54:57 +0000 (16:54 +0000)
- reset continuation level on flush
Found by oss-fuzz

src/softmagic.c

index 39a2cb5a0840e7a31a9afe07832b936ccd330060..b7d699387203d6e67d0a4d4f0d832641088d7154 100644 (file)
@@ -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;