1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/hevc/hevcdec: Don't add to null pointer

`POS(1,` and `POS(2,` may trigger UBSAN report:
"runtime error: applying non-zero offset 304 to null pointer"

Looks like values are not used without `chroma_format_idc`,
so maybe there is no other issues than the UB.

Can't reproduce with "fate".

Signed-off-by: Vitaly Buka <vitalybuka@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vitaly Buka
2025-01-16 15:49:19 -08:00
committed by James Almer
parent 02958ab715
commit c5287178b4

View File

@ -2040,9 +2040,10 @@ static void hls_prediction_unit(HEVCLocalContext *lc,
int x0, int y0, int nPbW, int nPbH,
int log2_cb_size, int partIdx, int idx)
{
#define POS(c_idx, x, y) \
#define POS(c_idx, x, y) \
&s->cur_frame->f->data[c_idx] ? \
&s->cur_frame->f->data[c_idx][((y) >> sps->vshift[c_idx]) * linesize[c_idx] + \
(((x) >> sps->hshift[c_idx]) << sps->pixel_shift)]
(((x) >> sps->hshift[c_idx]) << sps->pixel_shift)] : NULL
const HEVCContext *const s = lc->parent;
int merge_idx = 0;
struct MvField current_mv = {{{ 0 }}};