Commit a31547ce authored by Michael Niedermayer's avatar Michael Niedermayer

avutil/avstring: do not lose ascii characters when decoding non utf-8 with av_utf8_decode()

Fixes Ticket3363
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ca6dd53a
...@@ -331,15 +331,15 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, ...@@ -331,15 +331,15 @@ int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
while (code & top) { while (code & top) {
int tmp; int tmp;
if (p >= buf_end) { if (p >= buf_end) {
ret = AVERROR(EILSEQ); /* incomplete sequence */ (*bufp) ++;
goto end; return AVERROR(EILSEQ); /* incomplete sequence */
} }
/* we assume the byte to be in the form 10xx-xxxx */ /* we assume the byte to be in the form 10xx-xxxx */
tmp = *p++ - 128; /* strip leading 1 */ tmp = *p++ - 128; /* strip leading 1 */
if (tmp>>6) { if (tmp>>6) {
ret = AVERROR(EILSEQ); (*bufp) ++;
goto end; return AVERROR(EILSEQ);
} }
code = (code<<6) + tmp; code = (code<<6) + tmp;
top <<= 5; top <<= 5;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment