diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-15 03:38:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-15 03:50:30 +0200 |
commit | 73d820ee1eb0ab5b7d4b75d8f14a31ae9c3c11db (patch) | |
tree | eea0f1ed463411b02e19e7f6b827e96f7a7029b9 | |
parent | 103f9c261a68299125b99c542e20f5541051d2c9 (diff) | |
download | ffmpeg-streaming-73d820ee1eb0ab5b7d4b75d8f14a31ae9c3c11db.zip ffmpeg-streaming-73d820ee1eb0ab5b7d4b75d8f14a31ae9c3c11db.tar.gz |
avcodec/xbmdec: remove dependancy on zero padding on input packet
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/xbmdec.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c index e03ff31..143e3a2 100644 --- a/libavcodec/xbmdec.c +++ b/libavcodec/xbmdec.c @@ -82,10 +82,10 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, return ret; // goto start of image data - next = ptr + strcspn(ptr, "{"); - if (!*next) - next = ptr + strcspn(ptr, "("); - if (!*next) + next = memchr(ptr, '{', avpkt->size); + if (!next) + next = memchr(ptr, '(', avpkt->size); + if (!next) return AVERROR_INVALIDDATA; ptr = next + 1; @@ -95,7 +95,10 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, for (j = 0; j < linesize; j++) { uint8_t val; - ptr += strcspn(ptr, "x$") + 1; + while (ptr < end && *ptr != 'x' && *ptr != '$') + ptr++; + + ptr ++; if (ptr < end && av_isxdigit(*ptr)) { val = convert(*ptr++); if (av_isxdigit(*ptr)) |