From 9eee85817edcc7ad7e20ffadf0e43e1ba748cb35 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Tue, 10 Mar 2026 11:54:01 +0100 Subject: prog: add support for decimal/octal arguments in text format Previously, the parser only expected the '0' character to begin an integer argument, which effectively meant it only handled hexadecimal formatting (e.g., `0x...`) when parsing arguments. This change modifies parseArgImpl() to route any starting digit ('0'-'9') to the integer parsing logic. Since `strconv.ParseUint` already handles base-10 parsing using the "0" base flag, this cleanly enables the parser to natively deserialize decimal and octal arguments. --- prog/encoding_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'prog/encoding_test.go') diff --git a/prog/encoding_test.go b/prog/encoding_test.go index 130740df7..67ed3bc02 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -244,6 +244,14 @@ func TestDeserialize(t *testing.T) { { In: `test$excessive_fields1(0xffffffffffffffff)`, }, + { + In: `serialize1(&(0x7f0000000000)="0000000000000000", 300000)`, + Out: `serialize1(&(0x7f0000000000)=""/8, 0x493e0)`, + }, + { + In: `serialize1(&(0x7f0000000000)="0000000000000000", 010)`, + Out: `serialize1(&(0x7f0000000000)=""/8, 0x8)`, + }, { In: `test$excessive_fields1(0xfffffffffffffffe)`, }, -- cgit mrf-deployment