guard

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package guard checks a BRC-74 BUMP someone else supplied before the SDK is allowed to allocate for it.

A BUMP reader that sizes a slice from a wire count can be asked, by a handful of bytes, for an allocation that ends the process with an out-of-memory no recover() sees. go-sdk v1.5.2 bounds its leaf count itself, which is why that version is the floor, but whoever serves a proof is one more party choosing the bytes, and the rule for length-prefixed data from any other party is that a declared length is a claim, checked against the bytes present before it sizes memory.

There is no BEEF counterpart: go-sdk v1.5.2's BEEF parser bounds every count against the bytes remaining.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBUMP

func ParseBUMP(b []byte, bound int) (mp *transaction.MerklePath, err error)

ParseBUMP guards and parses one BRC-74 BUMP of at most bound bytes. The bound is the caller's, since only the caller knows how large an answer it was prepared to read; a bound of zero or less admits nothing.

The parse runs under a recover, so a malformed proof is an error and never a crash.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL