Skip to content

TEAL: Fix panic when checking macro names containing non-ASCII runes#6461

Merged
jannotti merged 1 commit intoalgorand:masterfrom
dragmz:checkmacro-panic-fix
Oct 10, 2025
Merged

TEAL: Fix panic when checking macro names containing non-ASCII runes#6461
jannotti merged 1 commit intoalgorand:masterfrom
dragmz:checkmacro-panic-fix

Conversation

@dragmz
Copy link
Copy Markdown
Contributor

@dragmz dragmz commented Oct 7, 2025

Summary

Fixes a panic when assembling TEAL code containing macros with non-ASCII runes, e.g.:

#define 👩 123
panic: runtime error: index out of range [128105] with length 256

goroutine 1 [running]:
github.com/algorand/go-algorand/data/transactions/logic.checkMacroName({0xc00000bca8, 0x4}, 0xffffffffffffffff, 0xc0007e2fc0)
	github.com/algorand/go-algorand/data/transactions/logic/assembler.go:2210 +0x87e
github.com/algorand/go-algorand/data/transactions/logic.define(0xc000164008, {0xc000390100, 0x3, 0x6?})
	github.com/algorand/go-algorand/data/transactions/logic/assembler.go:2260 +0x21f
github.com/algorand/go-algorand/data/transactions/logic.(*OpStream).assemble(0xc000164008, {0xc00000bb10, 0x10})
	github.com/algorand/go-algorand/data/transactions/logic/assembler.go:2060 +0x470
github.com/algorand/go-algorand/data/transactions/logic.AssembleStringWithVersion({0xc00000bb10, 0x10}, 0xffffffffffffffff)
	github.com/algorand/go-algorand/data/transactions/logic/assembler.go:2760 +0x171
github.com/algorand/go-algorand/data/transactions/logic.AssembleString(...)
	github.com/algorand/go-algorand/data/transactions/logic/assembler.go:2738

Test Plan

Added a new test case to verify that the macro name validation correctly rejects names containing disallowed characters.

Copy link
Copy Markdown
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@jannotti jannotti changed the title Fix panic when checking macro names containing non-ASCII runes TEAL: Fix panic when checking macro names containing non-ASCII runes Oct 10, 2025
@jannotti jannotti merged commit 0740b18 into algorand:master Oct 10, 2025
61 of 66 checks passed
@dragmz dragmz deleted the checkmacro-panic-fix branch October 11, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants