|
From: Dennis C. <dc...@bl...> - 2013-06-27 03:59:11
|
On Solaris 10 and compiled with gcc 4.8.0 I see this during testing :
Checking fragmentation capabilities of HAVAL256: /usr/local/bin/bash: line 4: 21260 Bus Error (core dumped) ${dir}$tst
FAIL: frag_test
============================================
1 of 5 tests failed
Please report to mha...@so...
============================================
Looking into this I see :
node002$ dbx ./src/.libs/frag_test time_1372300240-pid_21260-uid_16411-gid_1-fid_frag_test.core
Reading frag_test
core file header read successfully
Reading ld.so.1
Reading libmhash.so.2.0.1
Reading libc.so.1
Reading libgcc_s.so.1
Reading libc_psr.so.1
program terminated by signal BUS (invalid address alignment)
0xffffffff7f005a28: mutils_word32nswap+0x0094: ld [%g1], %g1
(dbx) where
=>[1] mutils_word32nswap(0xffffffff7fffeb09, 0x20, 0x0, 0x0, 0x0, 0x0), at 0xffffffff7f005a28
[2] havalTransform3(0x1001045d4, 0xffffffff7fffeb09, 0x100104680, 0x18c07f, 0xd2355034, 0x143367), at 0xffffffff7f029228
[3] havalUpdate(0x1001045d0, 0xffffffff7fffeb08, 0x81, 0xfffffffffffffff9, 0x0, 0xffffffff7fffeb89), at 0xffffffff7f040c4c
[4] mhash(0x100101dd0, 0xffffffff7fffeb08, 0x81, 0xffffffff7ef4fc81, 0x0, 0x140), at 0xffffffff7f004684
[5] frag_test(0x3, 0x0, 0x182ba0, 0x7fffffff, 0x0, 0x0), at 0x100001160
[6] main(0x1, 0xffffffff7fffefd8, 0xffffffff7fffefe8, 0x100101da0, 0x100000000, 0xffffffff7ea00200), at 0x100001568
(dbx) quit
Problem is here in lib/stdfns.c :
/*
* Byte swap a series of 32-bit integers. If destructive is set to false, the
* output will be placed in a freshly malloc()'ed buffer and the original
* data will remain intact.
*/
WIN32DLL_DEFINE
mutils_word32 *
mutils_word32nswap(mutils_word32 *x, mutils_word32 n, mutils_boolean destructive)
{
mutils_word32 loop;
mutils_word32 *buffer;
mutils_word32 *ptrIn;
mutils_word32 *ptrOut;
mutils_word32 count = n * 4;
if (destructive == MUTILS_FALSE)
{
buffer = mutils_malloc(count);
if (buffer == NULL)
{
return(NULL);
}
}
else
{
buffer = x;
}
/*
* This loop is totally useless for destructive processing of little-endian
* data on a little-endian machine.
*/
for (loop = 0, ptrIn = x, ptrOut = buffer; loop < n; loop++, ptrOut++, ptrIn++)
{
*ptrOut = mutils_lend32(*ptrIn);
}
return(buffer);
}
First thought I have is "why use a non-standard datatype where uint32_t works fine?" followed by "why not use calloc to zero fill the buffer ?
Anyways .. I see this mail list is essentially dead of traffic so I may just look into this, fix it and post the patch all to myself.
Dennis
|