Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heap-buffer-overflow in tsMuxer/hevc.cpp:79:28 #897

Open
caoxs999 opened this issue Aug 30, 2024 · 0 comments
Open

heap-buffer-overflow in tsMuxer/hevc.cpp:79:28 #897

caoxs999 opened this issue Aug 30, 2024 · 0 comments

Comments

@caoxs999
Copy link

version

commit 7f8667d1e6100a5b6407340d91ad80d57d976e58 (HEAD -> master, tag: nightly-2024-06-06-02-00-53, origin/master, origin/HEAD)
Author: iwashiira <[email protected]>
Date:   Thu Jun 6 03:13:25 2024 +0900

    added check for negative track_id values (#882)

reproduce

cd tsMuxer
mkdir build && cd build
cmake ../ -DCMAKE_C_COMPILER=clang  -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="-fsanitize=address" -DCMAKE_CXX_FLAGS="-fsanitize=address"
make 
./tsmuxer poc

Information :

tsMuxeR version git-7f8667d. github.com/justdan96/tsMuxer
HEVC muxing fps is not set. Get fps from stream. Value: 6538.89
HEVC manual defined fps doesn't equal to stream fps. Change HEVC fps from 0.884917 to 6538.89
=================================================================
==163285==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000001f7a at pc 0x55911d34ff06 bp 0x7ffcc68a18f0 sp 0x7ffcc68a18e8
READ of size 1 at 0x603000001f7a thread T0
    #0 0x55911d34ff05 in HevcUnit::updateBits(int, int, unsigned int) const /AFLplusplus/tsMuxer_prev/tsMuxer/hevc.cpp:79:28
    #1 0x55911d3520c1 in HevcVpsUnit::setFPS(double) /AFLplusplus/tsMuxer_prev/tsMuxer/hevc.cpp:235:5
    #2 0x55911d362d34 in HEVCStreamReader::updateStreamFps(void*, unsigned char*, unsigned char*, int) /AFLplusplus/tsMuxer_prev/tsMuxer/hevcStreamReader.cpp:373:10
    #3 0x55911d4ba8d6 in MPEGStreamReader::updateFPS(void*, unsigned char*, unsigned char*, int) /AFLplusplus/tsMuxer_prev/tsMuxer/mpegStreamReader.cpp:307:9
    #4 0x55911d35e3ff in HEVCStreamReader::checkStream(unsigned char*, int) /AFLplusplus/tsMuxer_prev/tsMuxer/hevcStreamReader.cpp:69:17
    #5 0x55911d408104 in METADemuxer::detectTrackReader(unsigned char*, int, AbstractStreamReader::ContainerType, int, int) /AFLplusplus/tsMuxer_prev/tsMuxer/metaDemuxer.cpp:785:22
    #6 0x55911d4054dd in METADemuxer::DetectStreamReader(BufferedReaderManager const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) /AFLplusplus/tsMuxer_prev/tsMuxer/metaDemuxer.cpp:685:35
    #7 0x55911d39b473 in detectStreamReader(char const*, MPLSParser*, bool) /AFLplusplus/tsMuxer_prev/tsMuxer/main.cpp:114:34
    #8 0x55911d3a333e in main /AFLplusplus/tsMuxer_prev/tsMuxer/main.cpp:689:17
    #9 0x7fc61414fd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #10 0x7fc61414fe3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #11 0x55911d1d7594 in _start (/AFLplusplus/tsMuxer_prev/install/bin/tsmuxer+0x23b594) (BuildId: e84fab34fa61c261f080dbcd6a5e78289b568c7f)

0x603000001f7a is located 2 bytes after 24-byte region [0x603000001f60,0x603000001f78)
allocated by thread T0 here:
    #0 0x55911d2abe0d in operator new[](unsigned long) (/AFLplusplus/tsMuxer_prev/install/bin/tsmuxer+0x30fe0d) (BuildId: e84fab34fa61c261f080dbcd6a5e78289b568c7f)
    #1 0x55911d34f79b in HevcUnit::decodeBuffer(unsigned char const*, unsigned char const*) /AFLplusplus/tsMuxer_prev/tsMuxer/hevc.cpp:41:19
    #2 0x55911d35e240 in HEVCStreamReader::checkStream(unsigned char*, int) /AFLplusplus/tsMuxer_prev/tsMuxer/hevcStreamReader.cpp:64:20
    #3 0x55911d408104 in METADemuxer::detectTrackReader(unsigned char*, int, AbstractStreamReader::ContainerType, int, int) /AFLplusplus/tsMuxer_prev/tsMuxer/metaDemuxer.cpp:785:22
    #4 0x55911d4054dd in METADemuxer::DetectStreamReader(BufferedReaderManager const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool) /AFLplusplus/tsMuxer_prev/tsMuxer/metaDemuxer.cpp:685:35
    #5 0x55911d39b473 in detectStreamReader(char const*, MPLSParser*, bool) /AFLplusplus/tsMuxer_prev/tsMuxer/main.cpp:114:34
    #6 0x55911d3a333e in main /AFLplusplus/tsMuxer_prev/tsMuxer/main.cpp:689:17
    #7 0x7fc61414fd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /AFLplusplus/tsMuxer_prev/tsMuxer/hevc.cpp:79:28 in HevcUnit::updateBits(int, int, unsigned int) const
Shadow bytes around the buggy address:
  0x603000001c80: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
  0x603000001d00: fd fd fa fa fd fd fd fa fa fa fd fd fd fa fa fa
  0x603000001d80: fd fd fd fa fa fa fd fd fd fd fa fa fd fd fd fa
  0x603000001e00: fa fa fd fd fd fa fa fa fd fd fd fd fa fa fd fd
  0x603000001e80: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
=>0x603000001f00: fd fd fd fa fa fa fd fd fd fa fa fa 00 00 00[fa]
  0x603000001f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x603000002000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x603000002080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x603000002100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x603000002180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==163285==ABORTING

poc

poc3

poc3.zip

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

No branches or pull requests

1 participant