mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 16:56:40 +08:00
Issue #10: Crashing sequence with nsSJISProber.
uchardet_handle_data() should not try to process data of nul length. Still this is not technically an error to feed empty data to the engine, and I could imagine it could happen especially when done in some automatic process with random input files (which looks like what was happening in the reporter case). So feeding empty data just returns a success without actually doing any processing, allowing to continue the data feed.
This commit is contained in:
parent
ef0313046b
commit
6c7f32a751
@ -91,7 +91,11 @@ void uchardet_delete(uchardet_t ud)
|
||||
|
||||
int uchardet_handle_data(uchardet_t ud, const char * data, size_t len)
|
||||
{
|
||||
nsresult ret = reinterpret_cast<HandleUniversalDetector*>(ud)->HandleData(data, (PRUint32)len);
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
if (len > 0)
|
||||
ret = reinterpret_cast<HandleUniversalDetector*>(ud)->HandleData(data, (PRUint32)len);
|
||||
|
||||
return (ret != NS_OK);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user