Skip to content

Conversation

@mauke
Copy link
Contributor

@mauke mauke commented Sep 21, 2025

The if (gv) check is pointless because GvIOp(gv) already dereferences gv, so if gv could be NULL, we'd already have undefined behavior (most likely a segfault) before reaching the if.

Make the code's implicit assumptions explicit by adding assert(gv) before dereferencing.

Fixes Coverity CID 584859.


  • This set of changes does not require a perldelta entry.

The `if (gv)` check is pointless because `GvIOp(gv)` already
dereferences `gv`, so if `gv` could be NULL, we'd already have undefined
behavior (most likely a segfault) before reaching the `if`.

Make the code's implicit assumptions explicit by adding `assert(gv)`
before dereferencing.

Fixes Coverity CID 584859.
Copy link
Contributor

@khwilliamson khwilliamson left a comment

Choose a reason for hiding this comment

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

I thought we had already changed leading tabs into blanks in core files. That should be done here.

@mauke mauke merged commit b9576c1 into Perl:blead Sep 22, 2025
34 checks passed
@mauke mauke deleted the fix-coverity-584859-null-check branch September 22, 2025 02:08
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.

2 participants