Use uint64_t for string length in decode_string
diff --git a/include/rive/core/reader.h b/include/rive/core/reader.h index 82eb80f..1779cc0 100644 --- a/include/rive/core/reader.h +++ b/include/rive/core/reader.h
@@ -33,7 +33,7 @@ /* Decodes a string */ inline size_t -decode_string(uint8_t str_len, const uint8_t* buf, const uint8_t* buf_end, char* char_buf) { +decode_string(uint64_t str_len, const uint8_t* buf, const uint8_t* buf_end, char* char_buf) { // Return zero bytes read on buffer overflow if (buf_end - buf < str_len) { return 0;
diff --git a/test/assets/long_name.riv b/test/assets/long_name.riv new file mode 100644 index 0000000..8dda98b --- /dev/null +++ b/test/assets/long_name.riv Binary files differ
diff --git a/test/file_test.cpp b/test/file_test.cpp index 4a0a99f..05d0e5e 100644 --- a/test/file_test.cpp +++ b/test/file_test.cpp
@@ -111,6 +111,14 @@ REQUIRE(world[5] == 29.535156f); } +TEST_CASE("long name in object is parsed correctly", "[file]") { + auto file = ReadRiveFile("../../test/assets/long_name.riv"); + auto artboard = file->artboard(); + + // Expect all object in file to be loaded, in this case 7 + REQUIRE(artboard->objects().size() == 7); +} + // TODO: // ShapePaint (fill/stroke) needs to be implemented in WASM (jsFill/jsStroke) in // order to create Paint objects as necessary.