[PATCH] libosmocore[master]: Fix msgb_test on 64 bit architectures

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Dec 9 17:00:15 UTC 2016


Review at  https://gerrit.osmocom.org/1401

Fix msgb_test on 64 bit architectures

truncating the unsigned long pointer msg->data to 'int' and then passin
git into msgb_resize_area() is unsafe as depending on the 32rd address
bit it will be eiether negative or positive.  That will in turn change
the expected "Sub area is not fully contained in the msg data\n" error
message into "Negative sizes are not allowed\n" which is not what the
autotest case expects.

Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa
---
M tests/msgb/msgb_test.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/01/1401/1

diff --git a/tests/msgb/msgb_test.c b/tests/msgb/msgb_test.c
index a726ef4..ac10382 100644
--- a/tests/msgb/msgb_test.c
+++ b/tests/msgb/msgb_test.c
@@ -195,7 +195,7 @@
 	OSMO_ASSERT(e != 0);
 
 	if (OSMO_PANIC_TRY(&e))
-		msgb_resize_area(msg, NULL, (int)msg->data, 0);
+		msgb_resize_area(msg, NULL, 0, 0);
 	OSMO_ASSERT(e != 0);
 
 	if (OSMO_PANIC_TRY(&e))

-- 
To view, visit https://gerrit.osmocom.org/1401
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list