lirong-Lee commented on issue #351:
URL:
https://github.com/apache/rocketmq-client-cpp/issues/351#issuecomment-814725797
@ifplusor
I looked at the java sdk, they are trying the whole process, when the data
is wrong, they directly catch it and then
```
catch (Exception e) {
byteBuffer.position(byteBuffer.limit());
}
```
Can we do this:
```
// 1 TOTALSIZE
int32_t storeSize = byteBuffer.getInt();
if (storeSize > byteBuffer.limit()) {
byteBuffer.position(byteBuffer.limit());
return nullptr;
}
// 15 BODY
int uncompress_failed = false;
int32_t bodyLen = byteBuffer.getInt();
if (bodyLen > (byteBuffer.limit() - 72)) {
byteBuffer.position(byteBuffer.limit());
return nullptr;
}
```
Do protection
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]