ruoruoniao commented on issue #3746:
URL: https://github.com/apache/fory/issues/3746#issuecomment-4677685002
In serializer, vector<uint32_t> will copy data into it. But in python, there
is all varint data. So it will went wrong at:
```cpp
// unsigne+_serializer.h
static inline std::vector<uint32_t> read_data(ReadContext &ctx) {
uint32_t total_bytes = ctx.read_var_uint32(ctx.error());
if (FORY_PREDICT_FALSE(ctx.has_error())) {
return std::vector<uint32_t>();
}
if (FORY_PREDICT_FALSE(total_bytes > ctx.config().max_binary_size)) {
ctx.set_error(Error::invalid_data("Binary size exceeds
max_binary_size"));
return std::vector<uint32_t>();
}
// HERE!
if (total_bytes % sizeof(uint32_t) != 0) {
ctx.set_error(Error::invalid_data("Invalid length: " +
std::to_string(total_bytes)));
return std::vector<uint32_t>();
}
if (FORY_PREDICT_FALSE(total_bytes > ctx.buffer().remaining_size())) {
ctx.set_error(Error::invalid_data("Invalid length: " +
std::to_string(total_bytes)));
return std::vector<uint32_t>();
}
size_t length = total_bytes / sizeof(uint32_t);
std::vector<uint32_t> vec(length);
if (total_bytes > 0) {
ctx.read_bytes(vec.data(), total_bytes, ctx.error());
}
return vec;
}
```
Because data is varint, so...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]