]> git.ipfire.org Git - thirdparty/json-c.git/commit
Tightening the number parsing algorithm 168/head
authorchl <dev+github@bugness.org>
Thu, 5 Feb 2015 00:34:10 +0000 (01:34 +0100)
committerchl <dev+github@bugness.org>
Thu, 5 Feb 2015 00:50:37 +0000 (01:50 +0100)
commit99d8fc975e059a5e1749d4dc6c07a02e9a629921
tree08da479bde67a5222b9dd5e5ba62e21ff46450ce
parentec4879ac5b502ae81f6b73450b960ede11ad2560
Tightening the number parsing algorithm

Some badly formated "numbers" could get partly parsed,
resulting in truncated results instead of raising an
error.

Examples :
 '1.2.3'      -> (double)1.2
 '2015-01-15' -> (int)2015

This patch is not perfect (ex: input can still end with a 'E', which
is forbidden by json.org doc) but should avoid non-sensically
formated input.

Tests added.
json_tokener.c
tests/test_parse.c
tests/test_parse.expected