Skip to content

from_lavc_vid_conv: guard NULL conversion in get_av_to_uv_conversion - #504

Open
armelvil wants to merge 1 commit into
CESNET:masterfrom
armelvil:fix/lavc-null-conversion
Open

from_lavc_vid_conv: guard NULL conversion in get_av_to_uv_conversion#504
armelvil wants to merge 1 commit into
CESNET:masterfrom
armelvil:fix/lavc-null-conversion

Conversation

@armelvil

Copy link
Copy Markdown
Contributor

When running encoder viability tests with file input to gauge codec suitability, I ran into an UltraGrid SEGV situation.

Root cause:
get_av_to_uv_conversion_int() can return a valid struct with conversion == NULL (the direct pixfmt-map, decoder, or CUDA early-return paths).
Since ecd4c53, the VERBOSE message in get_av_to_uv_conversion() unconditionally dereferences ret->conversion->uv_codec, crashing whenever a decoder emits a directly-mapped format (e.g. HEVC VAAPI -> NV12)

"-t file:$arg" was my vector for discovering it.

Fix:
guard the dereference. When conversion is NULL, fall through to the plain "converting A to B" message (which is accurate for those paths). Doing the same short-circuit elsewhere is unnecessary — the consumer in do_av_to_uv_conversion() already guards conversion != NULL.

I performed a local build with the patched file, ran through a couple of tests and it seemed OK.

It seems to have been introduced in ecd4c53.

get_av_to_uv_conversion_int() can return a valid struct with
conversion == NULL (direct pixfmt map, decoder, or CUDA early-return
paths), but since ecd4c53 the VERBOSE message unconditionally
dereferences ret->conversion->uv_codec, SEGV when -t file: decodes to a
directly-mapped format.

Regression introduced in ecd4c53.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant