https://bugs.exim.org/show_bug.cgi?id=2540
--- Comment #5 from Zoltan Herczeg <[email protected]> --- > Do you mean that this kind of reads past the end of the buffer is expected > from PCRE2+SIMD JIT ? Exactly. To understand it, you need to know about how virtual memory mapping is working. You can read about it here: https://en.wikipedia.org/wiki/Virtual_memory The CPU maps virtual addresses to physical addresses by replacing the upper bits of the address, but always keeps the lower n bits. Usually n is at least 12 (that means 4K pages). As far as I remember some architectures support 1K pages (n = 10), but I am not 100% sure. The point is: if you have a p pointer, which points to a valid memory byte (available to the current process), reading 16 byte from (p & ~(16 - 1)) is always valid. The (p & ~(16 - 1)) is called aligned memory address which means the lower 4 bits of p is zeroed. Therefore we can safely read data before the start and after the end of any buffer as long as the pointer is aligned, and the covered memory area contains at least 1 byte of the buffer. This is not limited to 16 bytes: any n where n is power of 2, and lower or equal than 1024 should work. SIMD works best with large amount of data, so JIT may read data before and after the subject buffer. However this should never cause any problem (except for valgrind). Let me know if you need more detailed explanation. -- You are receiving this mail because: You are on the CC list for the bug. -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev
