On 07/31/2010 09:35 PM, Bruno Haible wrote:
Hi Paolo,
I pushed it now, thanks for the review!
After I added some more unit tests for u8_strchr, I see crashes and assertion
failures:
1)
mem = (UNIT *) (page_boundary - 2 * sizeof (UNIT));
mem[0] = 0x50;
mem[1] = 0;
ASSERT (u8_strchr (mem, 0x123) == NULL); /* crashes */
2)
mem = (UNIT *) (page_boundary - 3 * sizeof (UNIT));
mem[0] = 0x50;
mem[1] = 0x50;
mem[2] = 0;
ASSERT (u8_strchr (mem, 0x123) == NULL); /* assertion failed */
3)
mem = (UNIT *) (page_boundary - 3 * sizeof (UNIT));
mem[0] = 0x50;
mem[1] = 0x50;
mem[2] = 0;
ASSERT (u8_strchr (mem, 0x3456) == NULL); /* crashes */
4)
mem = (UNIT *) (page_boundary - 4 * sizeof (UNIT));
mem[0] = 0x50;
mem[1] = 0x50;
mem[2] = 0x50;
mem[3] = 0;
ASSERT (u8_strchr (mem, 0x23456) == NULL); /* crashes */
I'm applying the two attached patches: Bug fixes, then comments and tiny
optimizations.
Thanks!
Paolo