From: Frank Plowman <post@frankplowman.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] lavc/vvc: Error pps_single_slice_per_subpic_flag
Date: Sat, 3 Feb 2024 14:54:13 +0100
Message-ID: <d5b625ee-c260-4f99-a35e-a3e8c9556b4e@frankplowman.com> (raw)
In-Reply-To: <CAFXK13fkNidmsZpZ5OsKjdJdBobNmXgyabFBSKT_5+K7h3erBw@mail.gmail.com>
On 02/02/2024 14:39, Nuo Mi wrote:
> On Thu, Feb 1, 2024 at 10:01 PM <post@frankplowman.com> wrote:
>
>> From: Frank Plowman <post@frankplowman.com>
>>
>> pps_single_slice_per_subpic_flag is not yet supported. Support is WIP,
>> but in the meantime throw an error when trying to decode a bitstream
>> with it set, avoiding an out-of-bounds array access.
>>
>> Fixes: out-of-bounds array access for conformance bitstreams
>> SUBPIC_C_ERICSSON_1, SUBPIC_D_ERICSSON_1, MNUT_A_Nokia_4 and
>> MNUT_B_Nokia_3.
>>
>> Signed-off-by: Frank Plowman <post@frankplowman.com>
>> ---
>> libavcodec/vvc/vvc_ps.c | 21 ++++++++++++++++-----
>> 1 file changed, 16 insertions(+), 5 deletions(-)
>>
>> diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
>> index 2cf156b323..bd81d70e71 100644
>> --- a/libavcodec/vvc/vvc_ps.c
>> +++ b/libavcodec/vvc/vvc_ps.c
>> @@ -381,11 +381,16 @@ static void pps_multi_tiles_slice(VVCPPS *pps, const
>> int tile_idx, const int i,
>> }
>> }
>>
>> -static void pps_rect_slice(VVCPPS* pps)
>> +static int pps_rect_slice(VVCPPS* pps)
>> {
>> const H266RawPPS* r = pps->r;
>> int tile_idx = 0, off = 0;
>>
>> + if (r->pps_single_slice_per_subpic_flag) {
>> + avpriv_report_missing_feature(NULL,
>> "pps_single_slice_per_subpic_flag");
>> + return AVERROR_PATCHWELCOME;
>> + }
>> +
>> for (int i = 0; i < r->pps_num_slices_in_pic_minus1 + 1; i++) {
>> if (!r->pps_slice_width_in_tiles_minus1[i] &&
>> !r->pps_slice_height_in_tiles_minus1[i]) {
>> @@ -396,9 +401,11 @@ static void pps_rect_slice(VVCPPS* pps)
>> }
>> tile_idx = next_tile_idx(tile_idx, i, r);
>> }
>> +
>> + return 0;
>> }
>>
>> -static void pps_no_rect_slice(VVCPPS* pps)
>> +static int pps_no_rect_slice(VVCPPS* pps)
>> {
>> const H266RawPPS* r = pps->r;
>> int ctu_x, ctu_y, off = 0;
>> @@ -409,20 +416,24 @@ static void pps_no_rect_slice(VVCPPS* pps)
>> pps_add_ctus(pps, &off, ctu_x, ctu_y,
>> r->col_width_val[tile_x], r->row_height_val[tile_y]);
>> }
>> }
>> +
>> + return 0;
>> }
>>
>> static int pps_slice_map(VVCPPS *pps)
>> {
>> + int ret;
>> +
>> pps->ctb_addr_in_slice = av_calloc(pps->ctb_count,
>> sizeof(*pps->ctb_addr_in_slice));
>> if (!pps->ctb_addr_in_slice)
>> return AVERROR(ENOMEM);
>>
>> if (pps->r->pps_rect_slice_flag)
>> - pps_rect_slice(pps);
>> + ret = pps_rect_slice(pps);
>> else
>> - pps_no_rect_slice(pps);
>> + ret = pps_no_rect_slice(pps);
>>
>> - return 0;
>> + return ret;
>> }
>>
> Thank you Frank. This changed too much code.
> How about we only check the sps_num_subpics_minus1 in decode_sps.
I wrote it like this so that the avpriv_report_missing_feature is where
the feature would need to be, helping readability and searchability. I
could remove the return from pps_rect_slice and pps_no_rect_slice which
would get rid of a handful of changed lines but the changes are trivial
so it is not a big deal imo.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-02-03 13:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 14:00 post
2024-02-02 13:39 ` Nuo Mi
2024-02-03 13:54 ` Frank Plowman [this message]
2024-02-03 14:46 ` Nuo Mi
2024-02-03 15:50 ` Frank Plowman
2024-02-03 15:56 ` Nuo Mi
2024-02-05 15:30 ` Frank Plowman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d5b625ee-c260-4f99-a35e-a3e8c9556b4e@frankplowman.com \
--to=post@frankplowman.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git