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

Joshua Batista via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 11:46:50 PST 2022


bob80905 accepted this revision.
bob80905 added a comment.
This revision is now accepted and ready to land.

Looks good to me. 
Only minor nit at llvm/lib/Object/DXContainer.cpp:114.
Changing the condition from  if (PartOffset >= Data.getBufferSize() - sizeof(dxbc::PartHeader::Name)) to  if (PartOffset >= Data.getBufferSize() - sizeof(dxbc::PartHeader::Name) && PartOffset < Data.getBufferSize()))
would allow the parsed error message to be more precise, by explicitly stating the error is due to the partOffset being unable to read the part header name.
Then, another condition,  PartOffset >= Data.getBufferSize())), would be able to definitively state that the part offset is beyond the file boundary.


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