Signed-off-by: Marton Balint <c...@passwd.hu> --- libavcodec/subviewerdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c index 805c7dd547..1016ac7ada 100644 --- a/libavcodec/subviewerdec.c +++ b/libavcodec/subviewerdec.c @@ -28,10 +28,10 @@ #include "ass.h" #include "libavutil/bprint.h" -static int subviewer_event_to_ass(AVBPrint *buf, const char *p) +static int subviewer_event_to_ass(AVBPrint *buf, const char *p, const char *pend) { - while (*p) { - if (!strncmp(p, "[br]", 4)) { + while (p < pend && *p) { + if (pend - p >= 4 && !strncmp(p, "[br]", 4)) { av_bprintf(buf, "\\N"); p += 4; } else { @@ -56,7 +56,7 @@ static int subviewer_decode_frame(AVCodecContext *avctx, AVBPrint buf; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); - if (ptr && avpkt->size > 0 && !subviewer_event_to_ass(&buf, ptr)) + if (ptr && avpkt->size > 0 && !subviewer_event_to_ass(&buf, ptr, ptr + avpkt->size)) ret = ff_ass_add_rect(sub, buf.str, s->readorder++, 0, NULL, NULL); av_bprint_finalize(&buf, NULL); if (ret < 0) -- 2.26.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".