[pcre-dev] [Bug 1449] New: ARMV5 - DataAbort exeption - 32Bi…

Página superior
Eliminar este mensaje
Autor: Björn Seiler
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] [Bug 1449] New: ARMV5 - DataAbort exeption - 32Bit access to char adress
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1449
           Summary: ARMV5 - DataAbort exeption - 32Bit access to char adress
           Product: PCRE
           Version: 8.34
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: bseiler@???
                CC: pcre-dev@???



Some ARM CPUs (may be old ones) can not access a byte aligned memory (char
array) with 32Bit pointer.

This is done for example in the compare_opcodes( ) function line 3064 in the
pcre_compile.c.

The pointer const pcre_uint32 *set1, *set2 and *set_end are used to compare 4
bytes in one step (3253f) to improve the performance as the comment say.

But if the pointer set1 or set2 is set to a non 32Bit aligned address the
operation *set1++ or *set2++ will fail with an exeption.


My current fast workaround is to define the three pointers as "pcre_uchar *"
and set set_end = set1 + 32; so it does not crash for the time.
I'm not sure in which functions I must fix the same issues.

If you want / need the "4Byte speed" you must check eighter if the pointer is
DWORD aligned (if(pointer & 0x03) == 0) and do single steps until there, or you
must copy the string / char array to an pcre_uint32 array which will
automatically be right alligned...


Tested with the pattern: "^[\w-\._\+%]+@(?:[\w-]+[\w]){2,6}$" on an AT91SAM9263
ARMv5 MCU with Rowley CrossStudio V2.0.11 and the pcre v8.34.
I also can check if the problem occures on linux with Qt on this controller.

I think there are two options:
- create a define which uses only byte access instead of the "4 bytes at once"
access (slower but fast to implement), or (the more powerful version) a special
version for such devices which cannot access byte adresses with 32bit pointern.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email