fix(proton): decode extended uint32 field varints
Consume complete well-formed value varints before retaining their low 32 bits, matching QQ push behavior without relaxing tag or length parsing. Add generator and end-to-end group reaction regressions, including truncated and malformed varint coverage. Refs #242.
This commit is contained in:
3 files changed
+54
-8
No files matched your search
@@ -119,9 +119,9 @@ function __readVarint64(data, offset, end) {
|
||||
}
|
||||
function __readVarint32Value(data, offset, end) {
|
||||
const [value, next] = __readVarint64(data, offset, end);
|
||||
if (value > 0xffffffffn && value < 0xffffffff80000000n) {
|
||||
throw new Error('protobuf uint32 field varint overflow');
|
||||
}
|
||||
// QQ-compatible protobuf runtimes consume a complete, well-formed uint32
|
||||
// value varint and retain its low 32 bits. Keep tags and lengths on
|
||||
// __readVarint32 so malformed framing still fails before it affects bounds.
|
||||
return [Number(BigInt.asUintN(32, value)), next];
|
||||
}
|
||||
function __skipVarint(data, offset, end) {
|
||||
|
||||
Reference in new issue
Block a user