This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new c48b8ebbbb avcodec/vulkan: fix DPX unpack offset
c48b8ebbbb is described below

commit c48b8ebbbb63ce2b3cf54571d18517117e6d6b46
Author:     Ruikai Peng <[email protected]>
AuthorDate: Fri Dec 12 13:51:12 2025 -0500
Commit:     Lynne <[email protected]>
CommitDate: Fri Dec 12 20:13:16 2025 +0000

    avcodec/vulkan: fix DPX unpack offset
    
    The DPX Vulkan unpack shader computes a word offset as
    
        uint off = (line_off + pix_off >> 5);
    
    Due to GLSL operator precedence this is evaluated as
    line_off + (pix_off >> 5) rather than (line_off + pix_off) >> 5.
    Since line_off is in bits while off is a 32-bit word index,
    scanlines beyond y=0 use an inflated offset and the shader reads
    past the end of the DPX slice buffer.
    
    Parenthesize the expression so that the sum is shifted as intended:
    
        uint off = (line_off + pix_off) >> 5;
    
    This corrects the unpacked data and removes the CRC mismatch
    observed between the software and Vulkan DPX decoders for
    mispacked 12-bit DPX samples. The GPU OOB read itself is only
    observable indirectly via this corruption since it occurs inside
    the shader.
    
    Repro on x86_64 with Vulkan/llvmpipe (531ce713a0e8):
    
        ./configure --cc=clang --disable-optimizations --disable-stripping \
            --enable-debug=3 --disable-doc --disable-ffplay \
            --enable-vulkan --enable-libshaderc \
            --enable-hwaccel=dpx_vulkan \
            --extra-cflags='-fsanitize=address -fno-omit-frame-pointer' \
            --extra-ldflags='-fsanitize=address' && make
    
        VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json
    
    PoC: packed 12-bit DPX with the packing flag cleared so the unpack
    shader runs (4x64 gbrp12le), e.g. poc12_packed0.dpx.
    
    Software decode:
    
        ./ffmpeg -v error -i poc12_packed0.dpx -f framecrc -
        -> 0, ..., 1536, 0x26cf81c2
    
    Vulkan hwaccel decode:
    
        VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/lvp_icd.json \
        ./ffmpeg -v error -init_hw_device vulkan \
            -hwaccel vulkan -hwaccel_output_format vulkan \
            -i poc12_packed0.dpx \
            -vf hwdownload,format=gbrp12le -f framecrc -
        -> 0, ..., 1536, 0x71e10a51
    
    The only difference between the two runs is the Vulkan unpack
    shader, and the stable CRC mismatch indicates that it is reading
    past the intended DPX slice region.
    
    Regression since: 531ce713a0e8
    Found-by: Pwno
---
 libavcodec/vulkan/dpx_unpack.comp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vulkan/dpx_unpack.comp 
b/libavcodec/vulkan/dpx_unpack.comp
index b04ce5ddc6..b5ca2cf509 100644
--- a/libavcodec/vulkan/dpx_unpack.comp
+++ b/libavcodec/vulkan/dpx_unpack.comp
@@ -51,7 +51,7 @@ i16vec4 parse_packed_in_32(ivec2 pos, int stride)
     uint line_off = pos.y*line_size;
     uint pix_off = pos.x*BITS_PER_COMP*COMPONENTS;
 
-    uint off = (line_off + pix_off >> 5);
+    uint off = (line_off + pix_off) >> 5;
     uint bit = pix_off & 0x1f;
 
     uint32_t d0 = read_data(off + 0);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to