From patchwork Sat May 6 00:10:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3588 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp471214vsd; Fri, 5 May 2017 17:11:28 -0700 (PDT) X-Received: by 10.28.49.195 with SMTP id x186mr2759478wmx.71.1494029488873; Fri, 05 May 2017 17:11:28 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a9si7723353wrc.284.2017.05.05.17.11.23; Fri, 05 May 2017 17:11:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E75E689A49; Sat, 6 May 2017 03:11:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5D33F689A2C for ; Sat, 6 May 2017 03:10:56 +0300 (EEST) Received: from [172.31.218.43] (helo=vie01a-dmta-pe05-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1d6nJN-0004YL-1Y for ffmpeg-devel@ffmpeg.org; Sat, 06 May 2017 02:11:01 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1d6nJH-0005UF-Hz for ffmpeg-devel@ffmpeg.org; Sat, 06 May 2017 02:10:55 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id GoAt1v00Y0S5wYM01oAuzR; Sat, 06 May 2017 02:10:54 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 6 May 2017 02:10:49 +0200 Message-Id: <20170506001050.23234-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170506001050.23234-1-michael@niedermayer.cc> References: <20170506001050.23234-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/srtdec: Check ff_htmlmarkup_to_ass() return code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Michael Niedermayer --- libavcodec/srtdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c index 862ab47645..ecc0801595 100644 --- a/libavcodec/srtdec.c +++ b/libavcodec/srtdec.c @@ -27,7 +27,7 @@ #include "ass.h" #include "htmlsubtitles.h" -static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, +static int srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, const char *in, int x1, int y1, int x2, int y2) { if (x1 >= 0 && y1 >= 0) { @@ -49,7 +49,7 @@ static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, } } - ff_htmlmarkup_to_ass(avctx, dst, in); + return ff_htmlmarkup_to_ass(avctx, dst, in); } static int srt_decode_frame(AVCodecContext *avctx, @@ -74,8 +74,9 @@ static int srt_decode_frame(AVCodecContext *avctx, av_bprint_init(&buffer, 0, AV_BPRINT_SIZE_UNLIMITED); - srt_to_ass(avctx, &buffer, avpkt->data, x1, y1, x2, y2); - ret = ff_ass_add_rect(sub, buffer.str, s->readorder++, 0, NULL, NULL); + ret = srt_to_ass(avctx, &buffer, avpkt->data, x1, y1, x2, y2); + if (ret >= 0) + ret = ff_ass_add_rect(sub, buffer.str, s->readorder++, 0, NULL, NULL); av_bprint_finalize(&buffer, NULL); if (ret < 0) return ret;