瀏覽代碼

oplist: Fix another OOB read

Credit to OSS-Fuzz
Nikias Bassen 2 年之前
父節點
當前提交
85f5cbd370
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 1 0
      fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4716194114699264
  2. 7 0
      src/oplist.c

+ 1 - 0
fuzz/oplist-crashes/clusterfuzz-testcase-minimized-oplist_fuzzer-4716194114699264

@@ -0,0 +1 @@
+(<

+ 7 - 0
src/oplist.c

@@ -715,6 +715,13 @@ static int node_from_openstep(parse_ctx ctx, plist_t *plist)
                 plist_free_data(data);
                 goto err_out;
             }
+            if (ctx->pos >= ctx->end) {
+                byte_array_free(bytes);
+                plist_free_data(data);
+                PLIST_OSTEP_ERR("EOF while parsing data terminator '>' at offset %ld\n", ctx->pos - ctx->start);
+                ctx->err++;
+                goto err_out;
+            }
             if (*ctx->pos != '>') {
                 byte_array_free(bytes);
                 plist_free_data(data);