diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-04-10 16:10:29 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-04-10 19:23:46 +0000 |
| commit | 6083db9d13eaaceec7d43a66e2baeb6902c3f36e (patch) | |
| tree | 99eddd6c0b02decef108f23f4e303093e9bd12be /pkg/csource/csource_test.go | |
| parent | 1cacc015cc3921bcc1a20c4a5459917d14cf70fd (diff) | |
pkg/csource: enforce the bit size of -1
syscall() is a variadic function, so we need to be careful when passing
const values in there without specifying their type.
For -1, we did not specify it, and on 64 bit architectures the de facto
passed value was 0xFFFFFFFF instead of 0xFFFFFFFFFFFFFFFF. Fix it and
add a test.
Closes #5921.
Diffstat (limited to 'pkg/csource/csource_test.go')
| -rw-r--r-- | pkg/csource/csource_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 472e82225..16aef1b14 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -240,6 +240,17 @@ syscall(SYS_csource7, /*flag=*/4ul); syscall(SYS_csource7, /*flag=BIT_0|0x4*/5ul); `, }, + + { + input: ` +csource0(0xffffffff) +csource8(0xffffffffffffffff) +`, + output: ` +syscall(SYS_csource0, /*num=*/(intptr_t)-1); +syscall(SYS_csource8, /*num=*/(intptr_t)-1); +`, + }, } for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { |
