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/OpenBSC@lists.osmocom.org/.
Holger Hans Peter Freyther holger at freyther.deOn Tue, Jan 07, 2014 at 12:07:16PM +0100, Jacob Erlbeck wrote:
> The legacy 7bit conversion functions (those without the '_n_' in the
> name) gave wrong return values on 64 bit platforms due to unproper
> signed/unsigned conversions and the usage of SIZE_MAX.
yes. it was a fun issue and it triggered an 'issue' in the msgb_put
as well.
if (msgb_tailroom(msgb) < (int) len)
MSGB_ABORT(msgb, "Not enough tailroom msgb_push (%u < %u)\n",
msgb_tailroom(msgb), len);
So when called with a big number the above assert will never hit and
we happily create a huge MSGB..
> for (i = 0; i < ARRAY_SIZE(test_encode); ++i) {
> + /* Test legacy function (return value only) */
> + septet_length = gsm_7bit_encode(coded,
> + (const char *) test_encode[i].input);
> + printf("Legacy encode case %d: "
> + "septet length %d (expected %d)\n"
> + , i
> + , septet_length, test_encode[i].expected_septet_length
> + );
> + OSMO_ASSERT (septet_length == test_encode[i].expected_septet_length);
> +
> + /* Test new function */
> memset(coded, 0x42, sizeof(coded));
I think we should do the memset before the first encode/decode as well.
Do you mind if I update the patch for that?