Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Crash on malformed json input. #6

Open
lvella opened this issue Apr 6, 2017 · 0 comments
Open

Crash on malformed json input. #6

lvella opened this issue Apr 6, 2017 · 0 comments

Comments

@lvella
Copy link

lvella commented Apr 6, 2017

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);
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant