From f12ca1cb327a7c44e666fcd4babb200bb3040a3c Mon Sep 17 00:00:00 2001 From: yangjunhui10 Date: Tue, 22 Jul 2025 21:29:21 +0800 Subject: [PATCH] fix source filesize error Signed-off-by: yangjunhui10 --- BUILD.gn | 1 + libavformat/id3v1.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index d42d901cc2..807f3530ff 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -168,6 +168,7 @@ config("ffmpeg_config") { "-DOHOS_CAL_DASH_BITRATE", "-DOHOS_AUXILIARY_TRACK", "-DOHOS_ABORT_FIX", + "-DOHOS_SOURCE_FILESIZE_ERROR_FIX", ] if (use_musl) { cflags += [ "-Wno-bool-operation" ] diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index 3189a48b8c..01cb75680b 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -284,6 +284,11 @@ void ff_id3v1_read(AVFormatContext *s) if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { /* XXX: change that */ filesize = avio_size(s->pb); +#ifdef OHOS_FILESIZE_FIX + if (filesize == 2147483646) {// to fix source filesize error + return; + } +#endif if (filesize > 128) { avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); -- Gitee