summaryrefslogtreecommitdiff
path: root/src/pcre2_intmodedep.h
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-02-27 17:19:51 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-02-27 17:19:51 +0000
commit5ec1fa7a7f5b785a1fe76f1d2f738389f436a47f (patch)
treeef60ec44b34684e73fc58f632abaae3c320f4822 /src/pcre2_intmodedep.h
parent034169b32e919f462b56bb4e68d9256673c59395 (diff)
downloadpcre2-5ec1fa7a7f5b785a1fe76f1d2f738389f436a47f.tar.gz
Add alignment patch for m68k.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@924 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_intmodedep.h')
-rw-r--r--src/pcre2_intmodedep.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pcre2_intmodedep.h b/src/pcre2_intmodedep.h
index c4c4c3a..d744e39 100644
--- a/src/pcre2_intmodedep.h
+++ b/src/pcre2_intmodedep.h
@@ -793,12 +793,23 @@ typedef struct heapframe {
uint8_t return_id; /* Where to go on in internal "return" */
uint8_t op; /* Processing opcode */
+ /* At this point, the structure is 16-bit aligned. On most architectures
+ the alignment requirement for a pointer will ensure that the eptr field below
+ is 32-bit or 64-bit aligned. However, on m68k it is fine to have a pointer
+ that is 16-bit aligned. We must therefore ensure that the occu vector is an
+ odd multiple of 16 bits so as to get back into 32-bit alignment. This happens
+ naturally when PCRE2_UCHAR is 8 bits wide, but needs fudges in the other
+ cases. Without these, this structure is no longer a multiple of PCRE2_SIZE
+ and the check below fails. */
+
#if PCRE2_CODE_UNIT_WIDTH == 8
PCRE2_UCHAR occu[6]; /* Used for other case code units */
#elif PCRE2_CODE_UNIT_WIDTH == 16
PCRE2_UCHAR occu[2]; /* Used for other case code units */
+ uint8_t unused[2]; /* Ensure 32-bit alignment (see above) */
#else
PCRE2_UCHAR occu[1]; /* Used for other case code units */
+ uint8_t unused[2]; /* Ensure 32-bit alignment (see above) */
#endif
/* The rest have to be copied from the previous frame whenever a new frame
@@ -818,6 +829,9 @@ typedef struct heapframe {
PCRE2_SIZE ovector[131072]; /* Must be last in the structure */
} heapframe;
+/* This typedef is a check that the size of the heapframe structure is a
+multiple of PCRE2_SIZE. See various comments above. */
+
typedef char check_heapframe_size[
((sizeof(heapframe) % sizeof(PCRE2_SIZE)) == 0)? (+1):(-1)];