Skip to content

Commit dec8f04

Browse files
author
James McLaughlin
committed
Fix possible null pointer dereference
1 parent 9ca82a6 commit dec8f04

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ json_value * json_parse_ex (json_settings * settings,
513513

514514
case ']':
515515

516-
if (top->type == json_array)
516+
if (top && top->type == json_array)
517517
flags = (flags & ~ (flag_need_comma | flag_seek_value)) | flag_next;
518518
else
519519
{ sprintf (error, "%d:%d: Unexpected ]", line_and_col);

tests/invalid-0010.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
]

0 commit comments

Comments
 (0)