client9 / stringencoders

Fast c-string transformations
MIT License
135 stars 51 forks source link

bus error on solaris in base64_decode() #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build on sparc (i suppose any platform that doesn't forgive unaligned writes)
2. run speedtest
3. you'll get bus error on decode test (the second line)

> What version of the product are you using? On what operating system?
$ uname -a
SunOS [] 5.10 Generic_118833-24 sun4v sparc SUNW,Sun-Fire-T200

my guess this happens because of unaligned write in modp_b64.c line 152
specificaly this fragment worries me:
        *destInt = x << 8;
        p += 3;
        destInt = (uint32_t*)p;

(here at some point you'll have uint32_t* pointing to p + 3, p + 6, etc.) and 
bang.

Original issue reported on code.google.com by anton.po...@gmail.com on 21 Jun 2007 at 3:35

GoogleCodeExporter commented 9 years ago
i use stringencoders-v3.3.0

Original comment by anton.po...@gmail.com on 21 Jun 2007 at 3:36

GoogleCodeExporter commented 9 years ago
fix seems to be trivial, here is a patch for the place i mentioned.
(surely it's not the cleanest fix possible, and i think it'll hurt performance)
please see the attached file for .patch.

thanks for great lib :)

Original comment by anton.po...@gmail.com on 21 Jun 2007 at 3:57

Attachments:

GoogleCodeExporter commented 9 years ago
Hi everyone.  I just saw this.  For some reason googlecode isn't sending me the 
emails.
Let me review ASAP.  Sorry for the delay.

thanks!

Original comment by nickgsup...@gmail.com on 27 Jun 2007 at 2:11

GoogleCodeExporter commented 9 years ago
Hi there,

If you could post your "config.h" file here, we can make an ifdef for solaris 
for
your patch.

thanks!

--nickg

Original comment by nickgsup...@gmail.com on 1 Jul 2007 at 2:30

GoogleCodeExporter commented 9 years ago
sorry, can't do that, the machine i tested on was given to us for tests only 
and already taken away
 :(
i've no other solaris machines around (luckily :) )

Original comment by anton.po...@gmail.com on 1 Jul 2007 at 2:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
solaris sucks deep on this, might patch solaris... because that's unacceptable 
8-), unaligned yes but still a size it's a size not variable geometry or I can 
trash many of my line of code written since 20 years or indeed... (known 
behavior), 

the interesting point here, is the COMPILER version please, can you provide 
this information might be reproducible on other hosts, and VC compiler on 
Windows might have exactly the same "issue" (if you can call that an issue, I 
would name that a choice), the trick would be a vector of ints, or even more 
dirty wrapping the thing into an packed struct 8-) cheers! I let you, then, I 
am going to whip myself repeating bad platform! bad unaligned mind! 8-D have a 
good day!

Original comment by 0xcafef...@gmail.com on 1 Jun 2011 at 5:13