]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
JSONFormattable incorrectly sets a string starting with digit as int 35870/head
authorSoumya Koduri <skoduri@redhat.com>
Thu, 24 Jun 2021 18:00:45 +0000 (23:30 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Thu, 21 Jul 2022 03:44:44 +0000 (09:14 +0530)
commit39323a2c492ec16f66e9607c962f6edf87f1c843
tree2b176675b4bf2ed2b758d2ec54ccfce05367ba40
parent103fe44f3ccc40e2a16132dc19ec375f4861c90d
JSONFormattable incorrectly sets a string starting with digit as int

JSONFormattable::set calls JSONParser::parse() to check if the given string
is a valid JSON object, which internally uses json_spirit::read to determine
the string type and copy it into data.
This routine incorrectly sets data type to integer if the string starts with
digit and copies only the first set of numeric values of the string.

To work-around this issue, verify if the entire string is parsed to
determine if its valid json data type.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
src/common/ceph_json.cc
src/test/common/test_json_formattable.cc