@@ -128,9 +128,10 @@ static int new_value (json_state * state,
128
128
the length of a JSON array is 0. The program attempts to use that memory
129
129
block later in the program.
130
130
131
- Diff - Added: free(*top);
132
- Payload - An empty JSON array: []
133
- Triggers - Use after free in json_value_free()
131
+ Diff - Added: free(*top);
132
+ Payload - An empty JSON array: []
133
+ Input File - emptyArray
134
+ Triggers - Use after free in json_value_free()
134
135
******************************************************************************/
135
136
136
137
free (* top );
@@ -1009,9 +1010,10 @@ void json_value_free_ex (json_settings * settings, json_value * value)
1009
1010
value->u.object.length, causing an invalid read when attempting to free the
1010
1011
memory space in the if-statement above.
1011
1012
1012
- Diff - [--value->u.object.length] --> [value->u.object.length--]
1013
- Payload - Any valid JSON object : {"":0}
1014
- Triggers - Invalid free in the above if-statement
1013
+ Diff - [--value->u.object.length] --> [value->u.object.length--]
1014
+ Payload - Any valid JSON object : {"":0}
1015
+ Input File - validObject
1016
+ Triggers - Invalid free in the above if-statement
1015
1017
******************************************************************************/
1016
1018
1017
1019
value = value -> u .object .values [value -> u .object .length -- ].value ;
@@ -1028,9 +1030,10 @@ void json_value_free_ex (json_settings * settings, json_value * value)
1028
1030
is empty. After decrementing, the program tries to call mem_free on the
1029
1031
pointer, which no longer references the JSON string.
1030
1032
1031
- Diff - Added: if (!value->u.string.length) value->u.string.ptr--;
1032
- Payload - An empty JSON string : ""
1033
- Triggers - Invalid free on decremented value->u.string.ptr
1033
+ Diff - Added: if (!value->u.string.length) value->u.string.ptr--;
1034
+ Payload - An empty JSON string : ""
1035
+ Input File - emptyString
1036
+ Triggers - Invalid free on decremented value->u.string.ptr
1034
1037
******************************************************************************/
1035
1038
1036
1039
if (!value -> u .string .length ){
@@ -1045,9 +1048,10 @@ void json_value_free_ex (json_settings * settings, json_value * value)
1045
1048
The code below creates and dereferences a NULL pointer if the string
1046
1049
is of length one.
1047
1050
1048
- Diff - Check for one byte string - create and dereference a NULL pointer
1049
- Payload - An JSON string of length one : "A"
1050
- Triggers - NULL pointer dereference
1051
+ Diff - Check for one byte string - create and dereference a NULL pointer
1052
+ Payload - A JSON string of length one : "A"
1053
+ Input File - oneByteString
1054
+ Triggers - NULL pointer dereference
1051
1055
******************************************************************************/
1052
1056
1053
1057
if (value -> u .string .length == 1 ) {
0 commit comments