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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 23:34:19 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)); \
----------------
MaskRay wrote:

Hi, I did not see the problem. If you have a PR, that will be appreciated!

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


More information about the llvm-commits mailing list