added range checks in response to compiler overflow warnings - #1522
Open
jgiovatto wants to merge 1 commit into
Open
added range checks in response to compiler overflow warnings#1522jgiovatto wants to merge 1 commit into
jgiovatto wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added range checks in response to compiler errors encountered when building on Fedora 43, gcc version 15.2.1 20260123 (Red Hat 15.2.1-7) (GCC)
srsRAN_4G_jgiovatto/lib/src/phy/fec/block/test/block_test.c:79:11: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
79 | tx[i] = (uint8_t)srsran_random_uniform_int_dist(random_gen, 0, 1);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
srsRAN_4G_jgiovatto/lib/src/phy/fec/block/test/block_test.c:71:18: note: at offset 11 into destination object ‘tx’ of size 11
71 | uint8_t tx[SRSRAN_FEC_BLOCK_MAX_NOF_BITS] = {};
srsRAN_4G_jgiovatto/lib/src/phy/phch/test/pusch_test.c: In function ‘main’:
srsRAN_4G_jgiovatto/lib/src/phy/phch/test/pusch_test.c:305:42: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
305 | uci_data_tx.value.ack.ack_value[a] = (uint8_t)srsran_random_uniform_int_dist(random_h, 0, 1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from srsRAN_4G_jgiovatto/lib/include/srsran/phy/phch/pucch_cfg.h:27,
from srsRAN_4G_jgiovatto/lib/include/srsran/phy/ch_estimation/refsignal_ul.h:35,
from srsRAN_4G_jgiovatto/lib/include/srsran/phy/ch_estimation/chest_ul.h:43,
from srsRAN_4G_jgiovatto/lib/include/srsran/srsran.h:51,
from srsRAN_4G_jgiovatto/lib/src/phy/phch/test/pusch_test.c:22:
srsRAN_4G_jgiovatto/lib/include/srsran/phy/phch/uci_cfg.h:32:11: note: at offset 10 into destination object ‘ack_value’ of size 10
32 | uint8_t ack_value[SRSRAN_UCI_MAX_ACK_BITS];
Note: Errors in ans1_utils.h were previously addressed in the ubuntu 22.04 builds branch. The though here is to check the capacity of the "other" object.