mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 00:02:52 +00:00
avutil/avstring: do not lose ascii characters when decoding non utf-8 with av_utf8_decode()
Fixes Ticket3363 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
ca6dd53a73
commit
a31547ce2e
@ -331,15 +331,15 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
|
||||
while (code & top) {
|
||||
int tmp;
|
||||
if (p >= buf_end) {
|
||||
ret = AVERROR(EILSEQ); /* incomplete sequence */
|
||||
goto end;
|
||||
(*bufp) ++;
|
||||
return AVERROR(EILSEQ); /* incomplete sequence */
|
||||
}
|
||||
|
||||
/* we assume the byte to be in the form 10xx-xxxx */
|
||||
tmp = *p++ - 128; /* strip leading 1 */
|
||||
if (tmp>>6) {
|
||||
ret = AVERROR(EILSEQ);
|
||||
goto end;
|
||||
(*bufp) ++;
|
||||
return AVERROR(EILSEQ);
|
||||
}
|
||||
code = (code<<6) + tmp;
|
||||
top <<= 5;
|
||||
|
Loading…
Reference in New Issue
Block a user