Fix memcpy nullptr src or dest (UB).
Detected by the new UBSan configurations (crbug.com/1352721): [ RUN ] TestDecodingState.FrameContinuity ../../modules/video_coding/session_info.cc:250:10: runtime error: null pointer passed as argument 1, which is declared to never be null ../../build/linux/debian_bullseye_amd64-sysroot/usr/include/string.h:44:28: note: nonnull attribute specified here No-Try: True Bug: None Change-Id: Ib4fb20d948b41da1a35dacb8abe944eb24f806f5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275200 Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38063}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
b88c3b5e02
commit
307f7f37e0
@ -243,6 +243,9 @@ size_t VCMSessionInfo::Insert(const uint8_t* buffer,
|
||||
size_t length,
|
||||
bool insert_start_code,
|
||||
uint8_t* frame_buffer) {
|
||||
if (!buffer || !frame_buffer) {
|
||||
return 0;
|
||||
}
|
||||
if (insert_start_code) {
|
||||
const unsigned char startCode[] = {0, 0, 0, 1};
|
||||
memcpy(frame_buffer, startCode, kH264StartCodeLengthBytes);
|
||||
|
||||
Reference in New Issue
Block a user