Skip to content

Conversation

@akien-mga
Copy link
Member

@akien-mga akien-mga commented May 2, 2024

Going through a few reports on https://scan.coverity.com/projects/godotengine-godot?tab=overview

Lots of low hanging fruits there to improve the code quality and find potential bugs.

The input mapping change fixes these issues:

@akien-mga akien-mga added this to the 4.3 milestone May 2, 2024
@akien-mga akien-mga requested review from a team as code owners May 2, 2024 11:13
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes this:
image

CC @clayjohn @BastiaanOlij

There's a bunch more issues with uninitialized stuff in rendering code, would be good for the rendering team to make a pass on the reports and decide whether to init all the structs properly, or what other approach to take. We've had a number of bugs on some platforms/GPUs due to uninitialized struct members.

Comment on lines +152 to +153
Copy link
Member Author

Choose a reason for hiding this comment

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

These fix these errors:
image

CC @lawnjelly

Copy link
Member

Choose a reason for hiding this comment

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

Although I'm in the blame this is because I'm registered as initial author for 4.x, but this was copy pasted from 3.x GLES2, which is karrofel it looks like.

But fix looks fine to me. 👍

Comment on lines -165 to -168
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed as the early return makes it dead code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes this:
image

But this is actually never set anywhere, so the code where it was being used is bogus.

It was added in #80973, CC @ryanabx.

Comment on lines +268 to +269
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes this:
image

CC @groud

Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes what I reported here: #73224 (comment)

image

CC @rsubtil

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it makes sense, I didn't notice that detail when changing the error message to a warning 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines 111 to 112
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about these. To me it seems totally pointless to initialize certain variables when we don't know if they will be used. The trouble is that we assign an RID before configuring the light. So the Coverity scan doesn't have enough information here to be really useful.

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed these changes from the PR for now.

Comment on lines 75 to 77
Copy link
Member Author

Choose a reason for hiding this comment

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

image

CC @Faless

Copy link
Member Author

Choose a reason for hiding this comment

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

This is C code so my fix was invalid, would need a different approach. Removed from this PR for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixes this type of errors:
image

CC @rsubtil

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, expensive ended up never being set in the code, so this was actually causing undefined behavior.

I can confirm it should be false as AFAIK Godot still doesn't support partial/pagination behavior to requesting variables from stack dumps, so there's no point in hinting such behavior to DAP when Godot will already have all that information.

Copy link
Member

Choose a reason for hiding this comment

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

There goes my little easter egg 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Brought it back ;)

@akien-mga akien-mga modified the milestones: 4.3, 4.4 May 29, 2024
@akien-mga akien-mga modified the milestones: 4.4, 4.3 May 31, 2024
@akien-mga akien-mga changed the title Fix various Coverity reports of uninitialized scalar variable Fix various Coverity reports of uninitialized scalar variable, fix Steam input CRC errors May 31, 2024
@akien-mga akien-mga changed the title Fix various Coverity reports of uninitialized scalar variable, fix Steam input CRC errors Fix Steam input "crc" errors, and some other Coverity reports of uninitialized scalar variable May 31, 2024
@akien-mga akien-mga added topic:input cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:codestyle cherrypick:4.1 and removed topic:codestyle labels May 31, 2024
@akien-mga akien-mga merged commit 41e762c into godotengine:master Jun 3, 2024
@akien-mga akien-mga deleted the coverity-checks branch June 3, 2024 08:59
@akien-mga akien-mga removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse_mapping error on Steam version only [Steam] [Linux] XBox Series X controller shows CRC errors

4 participants