Skip to content

Commit 540ea0b

Browse files
authored
Merge pull request #111761 from Ivorforce/fixed-array-warn
Fix false positive warning with `FixedVector` array bounds in gcc.
2 parents 6ae1cae + 6733345 commit 540ea0b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

core/templates/fixed_vector.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#include "core/templates/span.h"
3434

35+
GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Warray-bounds")
36+
3537
/**
3638
* A high performance Vector of fixed capacity.
3739
* Especially useful if you need to create an array on the stack, to
@@ -201,3 +203,5 @@ class FixedVector {
201203
_FORCE_INLINE_ constexpr const T *begin() const { return ptr(); }
202204
_FORCE_INLINE_ constexpr const T *end() const { return ptr() + _size; }
203205
};
206+
207+
GODOT_GCC_WARNING_POP

scene/main/multiplayer_peer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Error MultiplayerPeerExtension::get_packet(const uint8_t **r_buffer, int &r_buff
151151
}
152152

153153
Error MultiplayerPeerExtension::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
154+
ERR_FAIL_COND_V(p_buffer_size < 0, ERR_INVALID_PARAMETER);
154155
Error err;
155156
if (GDVIRTUAL_CALL(_put_packet, p_buffer, p_buffer_size, err)) {
156157
return err;

0 commit comments

Comments
 (0)