[PATCH] Frontend: Avoid some UB by checking a FileChange's validity before a call

Justin Bogner mail at justinbogner.com
Mon Jun 22 17:24:39 PDT 2015


If a FileChange has an invalid file, the FileType won't be initialized,
so it's undefined to pass it into Process like this. We immediately bail
out because the FileID is invalid in that case, so we can avoid the
issue by checking that first.

The alternative is to initialize FileType in FileChange's constructor,
but it's not clear if there's a reasonable default. Should I do that
instead, or is this good to commit?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ub-clang-rewrite.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150622/92a719df/attachment.bin>


More information about the cfe-commits mailing list