Change in libosmocore[master]: utils_test: fix isqrt_test calculation range

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Jul 19 20:18:52 UTC 2018


Neels Hofmeyr has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/10066 )

Change subject: utils_test: fix isqrt_test calculation range
......................................................................

utils_test: fix isqrt_test calculation range

Multiplying the uint16_t x by itself seems to default to be calculated in
int32_t range, while it obviously needs uint32_t. This causes sporadic
sanitizer barfs:

    Testing integer square-root
    utils_test.c:445:18: runtime error: signed integer overflow: 60369 * 60369 cannot be represented in type 'int'

The final result is still correct, because it is in fact interpreted as uint32_t.

Cast to uint32_t to make sure the sanitizer doesn't complain.

Related: OS#3407
Change-Id: I83c14e38deaa466d977ee43c9420534ed90f090d
---
M tests/utils/utils_test.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/66/10066/2
-- 
To view, visit https://gerrit.osmocom.org/10066
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I83c14e38deaa466d977ee43c9420534ed90f090d
Gerrit-Change-Number: 10066
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-CC: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180719/80a313c8/attachment.htm>


More information about the gerrit-log mailing list