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

MXFDump: fix index out of bounds error #76

Merged
merged 1 commit into from
May 30, 2024

Conversation

philipnbbc
Copy link
Collaborator

Issue #74 was (partially) replicated by building libMXF on Debian 11 with address sanitizer options as suggested for GCC here. However, no global-buffer-overflow error was reported; only a segmentation fault (e.g. shown when using just CXXFLAGS="-fsanitize=address").

Additional installs required: apt install libasan8 libubsan1
Build: CXXFLAGS="-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment" cmake -DCMAKE_BUILD_TYPE=Debug ../bmx/deps/libMXF

Running MXFDump on poc.mxf (provided in #74) results in

...
  47.01     :    06.0e.2b.34.01.01.01.02.06.01.01.04.02.03.00.00
  06.01     :    ea.0e.2b.34.01.01.01.02.05.30.04.04.01.00.00.00
  ff.ff     :    06.0e.2b.34.01.01.01.09.06.01.01.04.02.0d.00.00
MXFDump : Warning : Cannot remap static local key as specified by Primer Pack (property "EditUnitByteCount" has local key 3f05 in the MXF dictionary and 0000 in the Primer)
/build/bmx/deps/libMXF/tools/MXFDump/MXFDump.cpp:3320:42: runtime error: index 321 out of bounds for type 'MXFLocalKey [188]'

Fixes #74

The wrong table was used.

Fixes #74
@philipnbbc
Copy link
Collaborator Author

However, no global-buffer-overflow error was reported; only a segmentation fault (e.g. shown when using just CXXFLAGS="-fsanitize=address").

Changing Debug to Release (see issue comment) exposed the buffer overflow error

@philipnbbc philipnbbc merged commit fe923a9 into main May 30, 2024
10 checks passed
@philipnbbc philipnbbc deleted the philipn-MXFDump-fix-index-out-of-bounds branch July 8, 2024 08:27
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.

AddressSanitizer: global-buffer-overflow in updateAAFLocalKey function of MXFDump.cpp
1 participant