Skip to content

src/mp4property.h:414 Integer Underflow in MP4BytesProperty::GetValue #92

Description

@sigdevel

src/mp4property.h:414 Integer Underflow in MP4BytesProperty::GetValue

Description:

When processing a specially crafted MP4 file with malformed metadata/item atoms, mp4info crashes while fetching MP4 tags. The crash occurs in mp4v2::impl::MP4BytesProperty::GetValue() at src/mp4property.h:414, which is called from the metadata parsing path:

  • src/itmf/generic.cpp:206__itemAtomToModel
  • src/itmf/generic.cpp:308genericGetItems
  • src/itmf/Tags.cpp:72Tags::c_fetch
  • src/cmeta.cpp:133MP4TagsFetch
  • util/mp4info.cpp:90main

To Reproduce

Steps to reproduce the behavior:

./mp4info src_mp4property_h_414

Output:

asan-build:

show full -click to expand
=================================================================
==141330==ERROR: AddressSanitizer: unknown-crash on address 0x0000ffffffff at pc 0x7f6ba7322094 bp 0x7ffd3007a550 sp 0x7ffd30079d10
READ of size 4294967295 at 0x0000ffffffff thread T0                                                                                                        
    #0 0x7f6ba7322093 in memcpy ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:117
    #1 0x55f55eb2b8e1 in mp4v2::impl::MP4BytesProperty::GetValue(unsigned char**, unsigned int*, unsigned int) src/mp4property.h:414
    #2 0x55f55eb2b8e1 in __itemAtomToModel src/itmf/generic.cpp:206
    #3 0x55f55eb2bb43 in mp4v2::impl::itmf::genericGetItems(mp4v2::impl::MP4File&) src/itmf/generic.cpp:308
    #4 0x55f55eb24ed4 in mp4v2::impl::itmf::Tags::c_fetch(MP4Tags_s*&, void*) src/itmf/Tags.cpp:72
    #5 0x55f55eb161f0 in MP4TagsFetch src/cmeta.cpp:133
    #6 0x55f55eb0dbe7 in main util/mp4info.cpp:90
    #7 0x7f6ba6c33f74 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #8 0x7f6ba6c34026 in __libc_start_main_impl ../csu/libc-start.c:360
    #9 0x55f55eb0b8e0 in _start (/run/media/user/81c71df6-ca99-4d27-a7b6-55107e347080/mp4v2/runtime/sub/mp4v2/mp4info_asan+0x638e0) (BuildId: b2233bfe65c7ff1709d4cbbd7012f55656916e28)

Address 0x0000ffffffff is located in the shadow gap area.
SUMMARY: AddressSanitizer: unknown-crash src/mp4property.h:414 in mp4v2::impl::MP4BytesProperty::GetValue(unsigned char**, unsigned int*, unsigned int)
==141330==ABORTING

Environment

OS: tested at 6.12.25-1kali1 (2025-04-30) x86_64 GNU/Linux ;
Compiler version: Clang 21.1.8 ;
Build-opts:  -fsanitize=address,undefined -g -O1 ;
CPU type: x86_64 ;
mp4v2 - commit hash b7cdf09167124136d7b6bc9f7aa5ebdc95ed5d61 ;
MP4v2 version - 2.0.0 ;

Additional context

link to the sample (github-url):

src_mp4property_h_414

Screenshots

screen

screen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions