We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling typia.protobuf.decode (or typia.protobuf.createDecode) with Buffer throws 'buffer overflow'.
typia.protobuf.decode
typia.protobuf.createDecode
Buffer
minimal code to reproduce:
import typia from 'typia' type Foo = { id: number & typia.tags.Type<'int64'> } const decode = typia.protobuf.createDecode<Foo>() const obj = { id: 12 } const encoded = typia.protobuf.encode<Foo>(obj) try { const buffer1 = Buffer.from(encoded) const decoded1 = decode(buffer1) // throws console.log(obj, decoded1) } catch (e) { console.error(e) // Error on typia.protobuf.decode(): buffer overflow } // while this works fine. const buffer2 = Buffer.from(encoded.buffer, encoded.byteOffset, encoded.byteLength) const decoded2 = decode(buffer2) console.log(obj, decoded2) // { id: 12 }, { id: 12 }
I tried to patch the constructor code in $ProtobufReader to:
$ProtobufReader
public constructor(buf: Uint8Array) { this.buf = buf; this.ptr = 0; this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength); }
Then decode works fine.
The text was updated successfully, but these errors were encountered:
Fix samchon#912 - protobuf.decode byteOffset
7dab2d8
Good, waiting for your PR
Sorry, something went wrong.
c9a5f3b
Merge pull request #913 from ghlin/fix-decode
7009244
Fix #912 - protobuf.decode byteOffset
Published to v5.3.6 update.
samchon
No branches or pull requests
Calling
typia.protobuf.decode
(ortypia.protobuf.createDecode
) withBuffer
throws 'buffer overflow'.minimal code to reproduce:
I tried to patch the constructor code in
$ProtobufReader
to:Then decode works fine.
The text was updated successfully, but these errors were encountered: