aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding_test.go
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2026-03-10 11:54:01 +0100
committerAlexander Potapenko <glider@google.com>2026-03-10 14:52:26 +0000
commit9eee85817edcc7ad7e20ffadf0e43e1ba748cb35 (patch)
treed32dc6df8eb02f955741b1005da95558bac33a21 /prog/encoding_test.go
parentfeb3353f0d285ba3b66261f9ec7abf2334008822 (diff)
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.
Diffstat (limited to 'prog/encoding_test.go')
-rw-r--r--prog/encoding_test.go8
1 files changed, 8 insertions, 0 deletions
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
@@ -245,6 +245,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)`,
},
{