[llvm] [Support] Add end/error to decode[US]LEB128AndInc (PR #90006)

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 14:02:03 PDT 2024


================
@@ -155,6 +155,12 @@ TEST(LEB128Test, DecodeInvalidULEB128) {
     EXPECT_NE(Error, nullptr);                                                 \
     EXPECT_EQ(0ul, Actual);                                                    \
     EXPECT_EQ(ERROR_OFFSET, ErrorOffset);                                      \
+    Value = reinterpret_cast<const uint8_t *>(VALUE);                          \
+    Error = nullptr;                                                           \
+    Actual = decodeULEB128AndInc(Value, Value + strlen(VALUE), &Error);        \
+    EXPECT_NE(Error, nullptr);                                                 \
+    EXPECT_EQ(0ul, Actual);                                                    \
+    EXPECT_EQ(ERROR_OFFSET, Value - reinterpret_cast<const uint8_t *>(VALUE)); \
----------------
aganea wrote:

Hello @MaskRay!
There's no guarantee that `VALUE` here at L163 will be evaluated to the same value as `VALUE` when it was assigned at L158. Theses tests fail when building with latest MSVC using the Debug target. Same comment applies to other cases below.
Are you able to fix this or should I send a PR?

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


More information about the llvm-commits mailing list