Avoids a potentially shortening size_t to int cast in strauss_wnaf_ #841
pull real-or-random wants to merge 1 commits into bitcoin-core:master from real-or-random:202010_strauss_wnaf_counters changing 1 files +3 −3-
real-or-random commented at 1:57 pm on October 26, 2020: contributorFixes #834.
-
sipa cross-referenced this on Oct 26, 2020 from issue gcc emits -Warray-bounds warnings by hebasto
-
sipa commented at 7:47 pm on October 26, 2020: contributor
I confirm this fixes the
0In file included from src/secp256k1.c:16: 1src/ecmult_impl.h: In function ‘secp256k1_ecmult.constprop’: 2src/ecmult_impl.h:496:48: warning: array subscript [1, 268435456] is outside array bounds of ‘struct secp256k1_strauss_point_state[1]’ [-Warray-bounds] 3 496 | secp256k1_gej tmp = a[state->ps[np].input_pos]; 4 | ~~~~~~~~~~~~~^~~~~~~~~~ 5src/ecmult_impl.h:565:42: note: while referencing ‘ps’ 6 565 | struct secp256k1_strauss_point_state ps[1]; 7 | ^~ 8src/ecmult_impl.h:502:139: warning: array subscript [1, 268435456] is outside array bounds of ‘struct secp256k1_strauss_point_state[1]’ [-Warray-bounds] 9 502 | secp256k1_fe_mul(state->zr + np * ECMULT_TABLE_SIZE(WINDOW_A), state->zr + np * ECMULT_TABLE_SIZE(WINDOW_A), &(a[state->ps[np].input_pos].z)); 10 | ~~~~~~~~~~~~~^~~~~~~~~~ 11src/ecmult_impl.h:565:42: note: while referencing ‘ps’ 12 565 | struct secp256k1_strauss_point_state ps[1];
warning.
-
hebasto commented at 8:21 pm on October 26, 2020: member
Tested f1c9131c798107efa4b2e660ae37b183ac662741 on Linux Mint 20 (x86_64):
0$ gcc --version 1gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 2Copyright (C) 2019 Free Software Foundation, Inc. 3This is free software; see the source for copying conditions. There is NO 4warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 5 6$ make > /dev/null 7# no warnings :)
-
gmaxwell commented at 11:56 pm on October 26, 2020: contributorThis looks reasonable to me.
-
Avoids a potentially shortening size_t to int cast in strauss_wnaf_
Fixes #834.
-
real-or-random force-pushed on Oct 27, 2020
-
real-or-random marked this as ready for review on Oct 27, 2020
-
real-or-random commented at 1:19 am on October 27, 2020: contributorOk, I didn’t expect that this will also fix the warning! Updated the commit message accordingly.
-
sipa commented at 1:24 am on October 27, 2020: contributor
Ok, I didn’t expect that this will also fix the warning! Updated the commit message accordingly.
Bogus compiler warning acts bogusly.
-
sipa commented at 1:27 am on October 27, 2020: contributorACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f.
np
andno
shouldn’t ever take on negative values. -
jonasnick commented at 9:20 am on October 27, 2020: contributor
ACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f
Also kicked travis since it hadn’t started the job.
-
elichai commented at 10:06 am on October 27, 2020: contributorACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f Cool that it fixed the warning hehe
-
jonasnick merged this on Oct 27, 2020
-
jonasnick closed this on Oct 27, 2020
-
hebasto commented at 1:29 pm on October 27, 2020: memberIs it planned to pull this change into the Bitcoin Core repo before 0.21.0 branching off?
-
jasonbcox referenced this in commit 8f1b1aaef1 on Oct 27, 2020
-
deadalnix referenced this in commit 43bb9cebec on Oct 28, 2020
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 11:15 UTC
This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 11:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me