fix(proton): harden generated protobuf decoders

Reject malformed varints, out-of-bounds fields, and invalid groups before they escape their parent frame. Aggregate unknown-field metadata and decode signed int32 values while preserving SnowLuma's existing outbound encoding bytes.
This commit is contained in:
DrSmoothl committed 2026-07-10 13:40:53 +08:00
1 parent bb56030979
commit b7d648ea0f
7 files changed
+311 -32

No files matched your search

+16
View File
@@ -32,6 +32,22 @@ export type bytes = Uint8Array;
export function protobuf_encode<T>(params: T): Uint8Array;
export function protobuf_decode<T>(data: Uint8Array): T;
/** Non-enumerable metadata retained for protobuf tags unknown to the schema. */
export interface ProtobufUnknownField {
fieldNumber: number;
wireType: number;
count: number;
totalByteLength: number;
}
export interface ProtobufUnknownFieldMetadata {
fields: readonly ProtobufUnknownField[];
totalOccurrences: number;
omittedOccurrences: number;
omittedByteLength: number;
}
export function protobuf_getUnknownFields(value: unknown): readonly ProtobufUnknownField[];
export function protobuf_getUnknownFieldMetadata(value: unknown): ProtobufUnknownFieldMetadata;
// ── Optional runtime map fallback (disabled by default) ───────────────
export interface ProtobufRuntimeField {
name: string;