[clang] [clang][BufferUsage] Fix crash when parsing invalid format string (PR #170496)

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 12 03:56:08 PST 2025


flovent wrote:

> What do you think of going with an approach like this instead: https://github.com/llvm/llvm-project/issues/169629#issuecomment-3637937161 ?

This is another way to fix it and i am sure it's a correcy way too, we need to add some extra check for `UnsafeArg`.
I did it this way because `hasUnsafeFormatOrSArg`'s comment says it will make sure `UnsafeArg` is set to a valid state when it returns true.

> // `UnsafeArg` is the output argument that will be set only if this function
// returns true.

But i am ok with the other approach, just need to delete this comment.

https://github.com/llvm/llvm-project/pull/170496


More information about the cfe-commits mailing list