Skip to content

internal/report: guard against nil Symbol regexp in disasm and source rendering - #1014

Closed
anishesg wants to merge 2 commits into
google:mainfrom
proudhare:fix/ph-issue-789
Closed

internal/report: guard against nil Symbol regexp in disasm and source rendering#1014
anishesg wants to merge 2 commits into
google:mainfrom
proudhare:fix/ph-issue-789

Conversation

@anishesg

@anishesg anishesg commented Aug 2, 2026

Copy link
Copy Markdown

The disasm page crashes when accessed without a filter parameter because the Symbol regexp is nil. The code in PrintAssembly (report.go:400) and printSource (source.go:52) attempted to dereference the nil pointer when calling o.Symbol.String() or o.Symbol.MatchString().

This fix adds nil checks before accessing the Symbol regexp in three locations: PrintAssembly, printSource, and MakeWebList. When Symbol is nil, the code now treats it as matching all symbols (for MatchString) or uses an empty string in error messages (for String()).

The issue manifests when viewing profiles from different architectures (e.g., darwin/arm64 on linux/amd64) because the web UI calls the disasm endpoint without a symbol filter, causing a nil pointer dereference that displays as "no matches found for regexp:" with an empty regexp value.

Fixes #789

… rendering

The disasm page crashes when accessed without a filter parameter because the Symbol regexp is nil. The code in PrintAssembly (report.go:400) and printSource (source.go:52) attempted to dereference the nil pointer when calling o.Symbol.String() or o.Symbol.MatchString().

Signed-off-by: anish <anishesg@users.noreply.github.com>
@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.35%. Comparing base (ef3492d) to head (088c0b5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1014   +/-   ##
=======================================
  Coverage   67.35%   67.35%           
=======================================
  Files          44       44           
  Lines        7793     7803   +10     
=======================================
+ Hits         5249     5256    +7     
- Misses       2112     2115    +3     
  Partials      432      432           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aalexand

aalexand commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Do you mind attaching before/after screenshots or outputs from the tool to demonstrate the effect of the fix?

Also a question on this:

The issue manifests when viewing profiles from different architectures (e.g., darwin/arm64 on linux/amd64) because the web UI calls the disasm endpoint without a symbol filter,

Could you elaborate in the description why different architectures affect this?

Comment thread internal/report/report.go
var address *uint64
if hex, err := strconv.ParseUint(o.Symbol.String(), 0, 64); err == nil {
address = &hex
if o.Symbol != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think o.Symbol is nil in the described scenario, I think it points to a regexp for empty string.

If o.Symbol was nil, o.Symbol.String() would panic.

I don't think this PR fixes anything, so I'll close it.

@aalexand aalexand closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

disasm: no matches found for regexp

3 participants