Crash on malformed json input.
lvella opened this issue · comments
Following code is enough to crash the program, in function UJObjectUnpack()
:
#include <stdio.h>
#include "ujdecode.h"
int main() {
UJObject obj;
void *state;
const char input[] = "{\"a\": {}, \"b\": 200 } }";
size_t cbInput = sizeof(input) - 1;
const wchar_t *keys[] = { L"a", L"b"};
UJObject a, b;
obj = UJDecode(input, cbInput, NULL, &state);
UJObjectUnpack(obj, 2, "ON", keys, &a, &b);
UJFree(state);
}