Skip to content

V5.0 fix static analysis warnings - #9215

Open
Ev3nt wants to merge 6 commits into
FirebirdSQL:v5.0-releasefrom
Ev3nt:v5.0-fix-static-analysis-warnings
Open

Ev3nt wants to merge 6 commits into
FirebirdSQL:v5.0-releasefrom
Ev3nt:v5.0-fix-static-analysis-warnings

Conversation

@Ev3nt

@Ev3nt Ev3nt commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a set of warnings reported by the Svacer static analyzer.

Changes

  • Initialize previously uninitialized fields
  • Fix possible division by zero
  • Remove unused fields
  • Handle the return value of ftell() instead of ignoring errors
  • Remove redundant comparison with a null pointer
  • Fix null pointer dereference

Each fix is in a separate commit, so they can be reviewed one by one.

Behavior impact

These changes address potential defects and are not intended to alter expected behavior.

@aafemt

aafemt commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

IMHO, such risky (or incomplete) cleanup doesn't belong to a stable branch.

if (len < 0)
{
fclose(file);
(Arg::Gds(isc_fbsvcmgr_fp_read) << *av << Arg::OsError()).raise();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does fclose() clears the ftell() error ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, but it’s not necessary. We only use errno after the function has returned an error, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not sure I've got you. You going to report OS error when there was no OS error ?
Else, why use OsError() here ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Vlad means that if successful fclose() clears the OS error code, what you're going to return in the exception?

@Ev3nt Ev3nt Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I got u. Yeah, i need to save value of errno before close the file.

@Ev3nt

Ev3nt commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

IMHO, such risky (or incomplete) cleanup doesn't belong to a stable branch.

There’s only one branch that I found when I entered v5 in the input.

@aafemt

aafemt commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Unstable branch is called "master".

@dyemanov

Copy link
Copy Markdown
Member

IMHO, such risky (or incomplete) cleanup doesn't belong to a stable branch.

There’s only one branch that I found when I entered v5 in the input.

By default (unless the opposite is suggested explicitly) all cleanup / refactoring belongs to the master branch and only then may be considered for backporting into stable branches.

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.

4 participants