[PATCH] D112913: Misleading bidirectional detection

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 2 14:27:47 PDT 2021


rsmith added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:59
+    // If conversion fails, utf-8 is designed so that we can just try next char.
+    if (Result != llvm::conversionOK) {
+      ++CurPtr;
----------------
Is there a guarantee that `convertUTF8Sequence` doesn't update `CurPtr` on error? I'm concerned we might increment *past* the end in the case where `CurPtr` points to the end, below, which would at least formally be UB.


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

https://reviews.llvm.org/D112913



More information about the cfe-commits mailing list