Repository navigation
[FIX] Use RL16/RL32/RL64 for multi-byte values in asf_functions.c and general_loop.c - #2401
Open
muntasir-396 wants to merge 1 commit into
Open
muntasir-396 wants to merge 1 commit into
muntasir-396 wants to merge 1 commit into
Conversation
… general_loop.c Follow-up to CCExtractor#2353 and CCExtractor#2364, which eliminated unaligned multi-byte pointer casting across utility.h, mp4.c, ts_tables.c, and ccx_gxf.c. In asf_functions.c and general_loop.c, multi-byte values were read by casting arbitrary byte buffers to uint16_t *, uint32_t *, or int64_t * and dereferencing them. This is undefined behavior under C11 6.3.2.3p7 due to missing alignment guarantees, and breaks on big-endian platforms (ASF and RCWT header fields are little-endian). This patch: - Adds byte-wise RL64 and RB64 definitions to utility.h. - Replaces unaligned multi-byte pointer casts in asf_functions.c with RL16, RL32, and RL64. - Replaces unaligned multi-byte reads of RCWT headers in general_loop.c with RL64 and RL16.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #2353 and #2364, which eliminated unaligned multi-byte pointer casting across
utility.h,mp4.c,ts_tables.c, andccx_gxf.c.In
src/lib_ccx/asf_functions.candsrc/lib_ccx/general_loop.c, multi-byte values were still read by casting arbitrary byte pointers touint16_t *,uint32_t *, orint64_t *and dereferencing them. This is undefined behavior under C11 6.3.2.3p7 (missing alignment guarantee) and breaks on big-endian architectures (ASF and RCWT headers are little-endian).Changes
src/lib_ccx/utility.h: AddedRL64andRB64macros matching the byte-wise pattern ofRL16/RL32andRB16/RB32.src/lib_ccx/asf_functions.c: Replaced all unaligned pointer casts withRL16,RL32, andRL64throughout ASF header, stream property, content description, and data packet parsing.src/lib_ccx/general_loop.c: Replaced direct pointer casts when reading the 10-byte RCWT data header (FTSandcbcount) withRL64andRL16.