1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Fix incorrect logic in JSON number lexer

Detectable by gcc -Wlogical-op.

Add two regression test cases that would previously allow incorrect
values to pass.
This commit is contained in:
Peter Eisentraut
2012-05-20 02:24:46 +03:00
parent fe2534e534
commit f1f6737e15
3 changed files with 14 additions and 2 deletions

View File

@ -541,7 +541,7 @@ json_lex_number(JsonLexContext *lex, char *s)
if (*s == '.')
{
++s;
if (*s < '0' && *s > '9')
if (*s < '0' || *s > '9')
error = true;
else
{
@ -558,7 +558,7 @@ json_lex_number(JsonLexContext *lex, char *s)
++s;
if (*s == '+' || *s == '-')
++s;
if (*s < '0' && *s > '9')
if (*s < '0' || *s > '9')
error = true;
else
{