[PATCH] D110365: [llvm][profile] Do not read padding when printing build IDs
Roland McGrath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 23 15:23:21 PDT 2021
mcgrathr added inline comments.
================
Comment at: llvm/lib/ProfileData/InstrProfReader.cpp:548
+
// Increment by binary id length data type size.
BI += sizeof(BinaryIdLen);
----------------
The following code is still not robust to invalid BinaryIdLen values.
It needs to compare against Remaining (accounting for the size field just read) before using the value in arithmetic to avoid overflow risks. Computing a pointer from untrusted input and then comparing it to another pointer is never robust.
================
Comment at: llvm/lib/ProfileData/InstrProfReader.cpp:558
// Increment by binary id data length.
BI += BinaryIdLen;
if (BI > (const uint8_t *)DataBuffer->getBufferEnd())
----------------
What is the packing protocol? It seems wise to pad after *each* ID to make the next size field naturally-aligned, rather than having the second size field be misaligned if the first build ID length is not a multiple of 8.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110365/new/
https://reviews.llvm.org/D110365
More information about the llvm-commits
mailing list