Re: [Qemu-devel] [PATCH 21/56] json: Reject invalid UTF-8 sequences

2018-08-16 Thread Markus Armbruster
Eric Blake writes: > On 08/10/2018 09:40 AM, Markus Armbruster wrote: > +cp = mod_utf8_codepoint(ptr, 6, &end); >>> >>> Why are you hard-coding 6 here, rather than computing min(6, >>> strchr(ptr,0)-ptr)? If the user passes an invalid sequence at the end >>> of the string, can w

Re: [Qemu-devel] [PATCH 21/56] json: Reject invalid UTF-8 sequences

2018-08-10 Thread Eric Blake
On 08/10/2018 09:40 AM, Markus Armbruster wrote: +cp = mod_utf8_codepoint(ptr, 6, &end); Why are you hard-coding 6 here, rather than computing min(6, strchr(ptr,0)-ptr)? If the user passes an invalid sequence at the end of the string, can we end up making mod_utf8_codepoint() read

Re: [Qemu-devel] [PATCH 21/56] json: Reject invalid UTF-8 sequences

2018-08-10 Thread Markus Armbruster
Eric Blake writes: > On 08/08/2018 07:02 AM, Markus Armbruster wrote: >> We reject bytes that can't occur in valid UTF-8 (\xC0..\xC1, >> \xF5..\xFF in the lexer. That's insufficient; there's plenty of >> invalid UTF-8 not containing these bytes, as demonstrated by >> check-qjson: >> >> * Malform

Re: [Qemu-devel] [PATCH 21/56] json: Reject invalid UTF-8 sequences

2018-08-09 Thread Eric Blake
On 08/08/2018 07:02 AM, Markus Armbruster wrote: We reject bytes that can't occur in valid UTF-8 (\xC0..\xC1, \xF5..\xFF in the lexer. That's insufficient; there's plenty of invalid UTF-8 not containing these bytes, as demonstrated by check-qjson: * Malformed sequences - Unexpected continua

[Qemu-devel] [PATCH 21/56] json: Reject invalid UTF-8 sequences

2018-08-08 Thread Markus Armbruster
We reject bytes that can't occur in valid UTF-8 (\xC0..\xC1, \xF5..\xFF in the lexer. That's insufficient; there's plenty of invalid UTF-8 not containing these bytes, as demonstrated by check-qjson: * Malformed sequences - Unexpected continuation bytes - Missing continuation bytes after sta