Skip to content

Bug encoding/varint.ts: Should panic, When default buffer is too small #7147

@nurmohammed840

Description

@nurmohammed840
import { encodeVarint } from "jsr:@std/encoding/varint";
console.log("Invalid", encodeVarint(0x1234567891234567891n)); // It should panic, But it didn't
console.log("Valid", encodeVarint(0x1234567891234567891n, new Uint8Array(11)));
Invalid [
  Uint8Array(10) [
    145, 241, 217, 162,
    163, 162, 226, 179,
    197, 198
  ],
  11
]
Valid [
  Uint8Array(11) [
    145, 241, 217, 162,
    163, 162, 226, 179,
    197, 198,   4
  ],
  11
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions