[ 
https://issues.apache.org/jira/browse/FLINK-40225?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated FLINK-40225:
-----------------------------------
    Labels: pull-request-available  (was: )

> JSON parsing for json functions accepts trailing content after the first value
> ------------------------------------------------------------------------------
>
>                 Key: FLINK-40225
>                 URL: https://issues.apache.org/jira/browse/FLINK-40225
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 2.3.0
>            Reporter: Gustavo de Morais
>            Assignee: Gustavo de Morais
>            Priority: Major
>              Labels: pull-request-available
>
> {{JsonValueContext}} parsing does not reject malformed input when extra 
> content follows the first valid JSON value. Anything after the first value - 
> separated by a space or comma - is silently ignored, and the input is treated 
> as valid.
>  
> {code:java}
> SELECT 'true, false, null' IS JSON;                            -- TRUE 
> (expected FALSE)
> SELECT '{"1":"Hello", "2":"Goodbye"}, garbage here' IS JSON;   -- TRUE 
> (expected FALSE)
> SELECT 'true, false, anything at all' IS JSON;                 -- TRUE 
> (expected FALSE) {code}
> Each parses only the first value ({{{}true{}}}, the object, etc.) and drops 
> the rest, so the malformed string passes as valid JSON.
>  
> This affects every function built on the shared parser ({{{}IS JSON{}}}, 
> {{{}JSON_LENGTH{}}}, {{{}JSON_VALUE{}}}, {{{}JSON_QUERY{}}}, 
> {{{}JSON_EXISTS{}}}). For example, {{JSON_LENGTH('null, true, false')}} 
> returns {{1}} instead of {{{}NULL{}}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to