[pcre-dev] Memory overrun with LINK_SIZE 3

Top Page
Delete this message
Author: Ralf Junker
Date:  
To: pcre-dev
Subject: [pcre-dev] Memory overrun with LINK_SIZE 3
pcretest compiled with a LINK_SIZE of 3 results in a memory overrun
which can lead to an AV.

This is the pattern:

/^(A(*THEN:A)B|C(*THEN:B)D)/S
    AB
    CD
    ** Failers
    AC
    CB


This is the stack trace:

Pointer arithmetic overrun in process: pcretest.exe(7408)  -
pcre_study.c#499
  0x01EC35A5+32, that is at offset 53+32 in heap block 0x01EC3570 which
is only 80 bytes long.
    0x0044BE41 - pcre_study.c#499
    0x0044B472 - pcre_study.c#131
    0x0044D527 - pcre_study.c#1290
    0x00406138 - pcretest.c#1887
  The memory block (0x01EC3570) [size: 80 bytes] was allocated with malloc
    0x00403C3E - pcretest.c#1006
    0x0041A7E8 - pcre_compile.c#7237
    0x0041A02A - pcre_compile.c#6984
    0x00405ED1 - pcretest.c#1817


This is on Windows, but hopefully you can reproduce it with Valgrind.

Ralf