From patchwork Mon Apr 6 17:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 18724 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id C1C80448CAC for ; Mon, 6 Apr 2020 20:56:40 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A67C568B4AD; Mon, 6 Apr 2020 20:56:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4A1F568B307 for ; Mon, 6 Apr 2020 20:56:33 +0300 (EEST) Received: from creator.alpe-d-promontory.fun (192.168.13.165) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Mon, 6 Apr 2020 10:56:31 -0700 From: John Stebbins To: Date: Mon, 6 Apr 2020 11:52:06 -0600 Message-ID: <20200406175218.1299994-12-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200406175218.1299994-1-jstebbins@jetheaddev.com> References: <20200406175218.1299994-1-jstebbins@jetheaddev.com> MIME-Version: 1.0 X-Originating-IP: [192.168.13.165] Subject: [FFmpeg-devel] [PATCH 11/23] lavc/ass_split: fix parsing utf8 scripts 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The [Script Info] section was skipped if starts with UTF8 BOM --- libavcodec/ass_split.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 67da7c6d84..94c32667af 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -354,6 +354,9 @@ static int ass_split(ASSSplitContext *ctx, const char *buf) if (ctx->current_section >= 0) buf = ass_split_section(ctx, buf); + if(!memcmp(buf, "\xef\xbb\xbf", 3)) { // Skip UTF-8 BOM header + buf += 3; + } while (buf && *buf) { if (sscanf(buf, "[%15[0-9A-Za-z+ ]]%c", section, &c) == 2) { buf += strcspn(buf, "\n");