Skip to content

Commit 69923f0

Browse files
Add new case for golang runtime error crash type (#5146)
This should address another case of specific golang runtime crash type that has a log header (https://cloudlogging.app.goo.gl/2SVPLg9UojvYmekQA). For example `<2026/01/28 10:30:42 .../test/test.go:10:f.1() [E] Panic in test: runtime error: slice bounds out of range [:-1]` context: b/473559705
1 parent e139717 commit 69923f0

File tree

3 files changed

+74
-5
lines changed

3 files changed

+74
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
project/test/test2/l/f.go:161 (0x5b3aeab02b34)
2+
project/test/test2/m.go:313 (0x5b3aeaa88f15)
3+
project/test/test2/m.go:72 (0x5b3aeaa89423)
4+
project/test/test2/r.go:22 (0x5b3aeaa8c0d5)
5+
project/test/test2/c.go:421 (0x5b3aeaa83384)
6+
project/test/test2/i.go:22 (0x5b3aeaa9c00f)
7+
project/test/test2/fs/h/h.go:25 (0x5b3aeaa9bf9a)
8+
project/test/hi.go:519 (0x5b3aeab171fd)
9+
project/test/rer/rer.go:166 (0x5b3aea9391f0)
10+
project/test/a/a.go:505 (0x5b3aea8eb356)
11+
project/test/a/a.go:511 (0x5b3aea8eb59d)
12+
project/test/a/a.go:500 (0x5b3aea938fd3)
13+
project/test/rer/rer.go:161 (0x5b3aea938db0)
14+
project/test/m.go:118 (0x5b3aea9449a5)
15+
code.project.io/project/modules/mp/m/m.go:75 (0x5b3aeab61aab)
16+
code.project.io/project/modules/mp/m/m.go:228 (0x5b3aeab61a08)
17+
code.project.io/project/modules/mp/m/m.go:289 (0x5b3aeab622f3)
18+
runtime/asm_amd64.s:1693 (0x5b3aea3d9400)
19+
2026/01/26 09:04:35 .../m/m.go:210:r.1() [E] Panic in m: runtime error: slice bounds out of range [:-1]
20+
runtime/panic.go:129 (0x5b3aea398e53)
21+
project/test/test2/l/filer.go:1310 (0x5b3aeab01459)
22+
project/test/test2/l/filer.go:486 (0x5b3aeaaf5174)
23+
project/test/test2/m.go:33 (0x5b3aeaa88f15)
24+
project/test/test2/r.go:266 (0x5b3aeaa8c0d5)
25+
project/test/test2/i.go:36 (0x5b3aeaa87ca1)
26+
project/test/test2/r.go:207 (0x5b3aeaa8bd6e)
27+
project/test/test2/c.go:15 (0x5b3aeaa83384)
28+
project/test/test2/i.go:15 (0x5b3aeaa9c00f)
29+
project/test/test2/fs/h/h.go:225 (0x5b3aeaa9bf9a)
30+
project/test/hi.go:519 (0x5b3aeab171fd)
31+
project/test/rer/rer.go:166 (0x5b3aea9391f0)
32+
project/test/a/a.go:505 (0x5b3aea8eb356)
33+
project/test/a/a.go:511 (0x5b3aea8eb59d)
34+
project/test/a/a.go:500 (0x5b3aea938fd3)
35+
project/test/rer/rer.go:161 (0x5b3aea938db0)
36+
project/test/m.go:118 (0x5b3aea9449a5)
37+
code.project.io/project/modules/mp/m/m.go:75 (0x5b3aeab61aab)
38+
code.project.io/project/modules/mp/m/m.go:228 (0x5b3aeab61a08)
39+
code.project.io/project/modules/mp/m/m.go:289 (0x5b3aeab622f3)
40+
runtime/asm_amd64.s:1693 (0x5b3aea3d9400)
41+
ALARM: working on the last Unit for 28 seconds
42+
and the timeout value is 25 (use -timeout=N to change)
43+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
44+
artifact_prefix='/mnt/scratch0/clusterfuzz/bot/inputs/fuzzer-testcases/'; Test unit written to /mnt/scratch0/clusterfuzz/bot/inputs/fuzzer-testcases/timeout-aaa
45+
==280== ERROR: libFuzzer: timeout after 28 seconds
46+
#0 0x5b3aea321f51 in __sanitizer_print_stack_trace /src/llvm-project/compiler-rt/lib/asan/asan_stack.cpp:87:3
47+
#1 0x5b3aea213cf8 in fuzzer::PrintStackTrace() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerUtil.cpp:210:5
48+
#2 0x5b3aea1f67cd in fuzzer::Fuzzer::AlarmCallback() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:304:5
49+
#3 0x7a3eccdc441f in libpthread.so.0
50+
#4 0x5b3aea41127d in strings.ToLower strings/strings.go:735

src/clusterfuzz/_internal/tests/core/crash_analysis/stack_parsing/stack_analyzer_test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,6 +3296,20 @@ def test_golang_panic_runtime_error_slice_bounds_out_of_range(self):
32963296
expected_state, expected_stacktrace,
32973297
expected_security_flag)
32983298

3299+
def test_golang_panic_runtime_error_slice_bounds_oor_with_log_header(self):
3300+
"""Test go stacktrace with panic by slice bounds oor with log header."""
3301+
data = self._read_test_data(
3302+
'golang_panic_runtime_error_slice_bounds_with_log_header.txt')
3303+
expected_type = 'Slice bounds out of range'
3304+
expected_address = ''
3305+
expected_state = 'strings.ToLower\n'
3306+
3307+
expected_stacktrace = data
3308+
expected_security_flag = False
3309+
self._validate_get_crash_data(data, expected_type, expected_address,
3310+
expected_state, expected_stacktrace,
3311+
expected_security_flag)
3312+
32993313
def test_golang_panic_runtime_error_integer_divide_by_zero(self):
33003314
"""Test golang stacktrace with panic caused by integer divide by zero."""
33013315
data = self._read_test_data(

src/clusterfuzz/stacktraces/constants.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,20 @@
340340

341341
# Golang specific regular expressions.
342342
GOLANG_DIVISION_BY_ZERO_REGEX = re.compile(
343-
r'^panic( in .*)?: runtime error: integer divide by zero.*')
343+
r'^(?:.* )?panic( in .*)?: runtime error: integer divide by zero.*',
344+
re.IGNORECASE)
344345
GOLANG_INDEX_OUT_OF_RANGE_REGEX = re.compile(
345-
r'^panic( in .*)?: runtime error: index out of range.*')
346+
r'^(?:.* )?panic( in .*)?: runtime error: index out of range.*',
347+
re.IGNORECASE)
346348
GOLANG_INVALID_MEMORY_ADDRESS_REGEX = re.compile(
347-
r'^panic( in .*)?: runtime error: invalid memory address.*')
349+
r'^(?:.* )?panic( in .*)?: runtime error: invalid memory address.*',
350+
re.IGNORECASE)
348351
GOLANG_MAKESLICE_LEN_OUT_OF_RANGE_REGEX = re.compile(
349-
r'^panic( in .*)?: runtime error: makeslice: len out of range.*')
352+
r'^(?:.* )?panic( in .*)?: runtime error: makeslice: len out of range.*',
353+
re.IGNORECASE)
350354
GOLANG_SLICE_BOUNDS_OUT_OF_RANGE_REGEX = re.compile(
351-
r'^panic( in .*)?: runtime error: slice bounds out of range.*')
355+
r'^(?:.* )?panic( in .*)?: runtime error: slice bounds out of range.*',
356+
re.IGNORECASE)
352357
GOLANG_STACK_OVERFLOW_REGEX = re.compile(r'^fatal error: stack overflow.*')
353358

354359
GOLANG_CRASH_TYPES_MAP = [

0 commit comments

Comments
 (0)