-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various -Wmaybe-uninitialized warnings from GCC 12.2.1 #66248
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -743,7 +743,7 @@ void RenderingServer::mesh_surface_make_offsets_from_format(uint32_t p_format, i | |
r_attrib_element_size = 0; | ||
r_skin_element_size = 0; | ||
|
||
uint32_t *size_accum; | ||
uint32_t *size_accum = nullptr; | ||
|
||
for (int i = 0; i < RS::ARRAY_MAX; i++) { | ||
r_offsets[i] = 0; // Reset | ||
|
@@ -847,8 +847,12 @@ void RenderingServer::mesh_surface_make_offsets_from_format(uint32_t p_format, i | |
} | ||
} | ||
|
||
r_offsets[i] = (*size_accum); | ||
(*size_accum) += elem_size; | ||
if (size_accum != nullptr) { | ||
r_offsets[i] = (*size_accum); | ||
(*size_accum) += elem_size; | ||
} else { | ||
r_offsets[i] = 0; | ||
} | ||
Comment on lines
+850
to
+855
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please review @godotengine/rendering @TokageItLab. I don't know if that's the right fix but reading the code it does look like we're potentially dereferencing an uninitialized pointer here since it's only initialized for |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative is to initialize this variable before the switch even though it should be properly initialized in all switch branches.
The problem as I understand it is that enums suck :) So even if we make sure only those three values are passed as input, in theory something could call with a garbage int and it would work just fine, using uninitialized
texture.rd_type
.