p11-kit >= 0.23.6 assertion error on 32bit big endian

Andreas Metzler ametzler at bebt.de
Mon Jul 10 17:23:04 UTC 2017


On 2017-07-10 Daiki Ueno <dueno at redhat.com> wrote:
> Andreas Metzler <ametzler at bebt.de> writes:

> > Still no luck. :-(
> >
> > ok 12 /rpc/byte-value
> > not ok 13 /rpc/ulong-value
> > # assertion failed (7 + 4 == buffer.len): (11 == 15)
> > # in test_ulong_value() at test-rpc.c:429

> I missed the fact that a ulong value is always stored as 64-bit integer
> internally.  The following change to the previous patch should fix the
> issue:

> - assert_num_eq (7 + SIZEOF_UNSIGNED_LONG, buffer.len);
> + assert_num_eq (7 + 8, buffer.len);

Hello,

The test succeeded after also changing
assert_num_eq (7 + SIZEOF_UNSIGNED_LONG, offset);
assert_num_eq (7 + 8, offset);

Thanks.

There are a couple of ugly warnings, though:
p11-kit/test-rpc.c: In function 'test_ulong_value':
p11-kit/test-rpc.c:398:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  CK_ULONG val = 0xFFFFFFFFFFFFFFFF;
                 ^~~~~~~~~~~~~~~~~~
p11-kit/test-rpc.c:412:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  val = 0xFFFFFFFFFFFFFFFF;
        ^~~~~~~~~~~~~~~~~~
In file included from p11-kit/test-rpc.c:37:0:
./common/test.h:75:28: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  do { unsigned long __n1 = (a1); \
                            ^
./common/test.h:82:2: note: in expansion of macro 'assert_num_cmp'
  assert_num_cmp(a1, ==, a2)
  ^~~~~~~~~~~~~~
p11-kit/test-rpc.c:419:2: note: in expansion of macro 'assert_num_eq'
  assert_num_eq (0xFFFFFFFFFFFFFFFF, val);
  ^~~~~~~~~~~~~
p11-kit/test-rpc.c:425:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  val = 0x0123456708ABCDEF;
        ^~~~~~~~~~~~~~~~~~
p11-kit/test-rpc.c:431:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  val = 0xFFFFFFFFFFFFFFFF;
        ^~~~~~~~~~~~~~~~~~
In file included from p11-kit/test-rpc.c:37:0:
./common/test.h:75:28: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  do { unsigned long __n1 = (a1); \
                            ^
./common/test.h:82:2: note: in expansion of macro 'assert_num_cmp'
  assert_num_cmp(a1, ==, a2)
  ^~~~~~~~~~~~~~
p11-kit/test-rpc.c:436:2: note: in expansion of macro 'assert_num_eq'
  assert_num_eq (0x0123456708ABCDEF, *(CK_ULONG *)&val);
  ^~~~~~~~~~~~~
p11-kit/test-rpc.c:439:8: warning: large integer implicitly truncated to unsigned type [-Woverflow]
  val = 0xFFFFFFFFFFFFFFFF;
        ^~~~~~~~~~~~~~~~~~

cu Andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'


More information about the p11-glue mailing list