[PATCH] D139681: [DX] Improve parse error messages

Joshua Batista via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 16:55:32 PST 2022


bob80905 added inline comments.


================
Comment at: llvm/lib/Object/DXContainer.cpp:109-113
     // We need to ensure that each part offset leaves enough space for a part
     // header. To prevent overflow, we subtract the part header size from the
     // buffer size, rather than adding to the offset. Since the file header is
     // larger than the part header we can't reach this code unless the buffer
     // is larger than the part header, so this can't underflow.
----------------
This comment blocks seems pretty irrelevant now, so maybe it should be removed / updated.
I am also concerned this might change some error text behavior, since I don't see the PartOffset variable ever getting the header size value subtracted from it.
Although it's possible to exit early when PartOffset < LastOffset, what happens if, say, PartOffset = Data.getBufferSize() - sizeof(dxbc::PartHeader) + 1? 
In the old code, it returns, but in this new code, it might not enter the if block, right?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139681/new/

https://reviews.llvm.org/D139681



More information about the llvm-commits mailing list