Skip to content

Conversation

@grey3228
Copy link

Hello!

I used SAST tool Svace and found a couple of newGenericDecompressor function usages, where returned possibly non-nil err is not checked before dereferencing returned decompressor. It may lead to nil ptr dereferencing.

This PR adds check for err to prevent dereferencing potentially nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

None

There is a couple of newGenericDecompressor function usages, where
returned possibly non-nil `err` is not checked before dereferencing
returned decompressor. It may lead to nil ptr dereferencing.

This commit adds check for `err` to prevent dereferencing potentially
nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
@baude baude added the No New Tests Allow PR to proceed without adding regression tests label Nov 20, 2025
@baude
Copy link
Member

baude commented Nov 20, 2025

LGTM, honestly, took me a minute to get it before it was a facepalm

@baude
Copy link
Member

baude commented Nov 20, 2025

I've added the no-test label and restarted tests.

@mheon
Copy link
Member

mheon commented Nov 20, 2025

The return should probably be changed to return nil instead of err, given err is now guaranteed to be nil... but that's not worth re-pushing over.
/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 20, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grey3228, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit fac259e into containers:main Nov 20, 2025
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. machine No New Tests Allow PR to proceed without adding regression tests release-note-none

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants