summaryrefslogtreecommitdiffstats
path: root/src/libuemf
diff options
context:
space:
mode:
Diffstat (limited to 'src/libuemf')
-rw-r--r--src/libuemf/Makefile_insert30
-rw-r--r--src/libuemf/uemf.h24
2 files changed, 18 insertions, 36 deletions
diff --git a/src/libuemf/Makefile_insert b/src/libuemf/Makefile_insert
deleted file mode 100644
index 427a0e80e..000000000
--- a/src/libuemf/Makefile_insert
+++ /dev/null
@@ -1,30 +0,0 @@
-## Makefile.am fragment sourced by src/Makefile.am.
-
-libuemf/all: libuemf.a
-
-libuemf/clean:
- rm -f libuemf/libuemf.a $(libuemf_libuemf_a_OBJECTS)
-
-libuemf_libuemf_a_SOURCES = \
- libuemf/uemf.c \
- libuemf/uemf.h \
- libuemf/uemf_endian.c \
- libuemf/uemf_endian.h \
- libuemf/uemf_print.c \
- libuemf/uemf_print.h \
- libuemf/uemf_safe.c \
- libuemf/uemf_safe.h \
- libuemf/uemf_utf.c \
- libuemf/uemf_utf.h \
- libuemf/uwmf.c \
- libuemf/uwmf.h \
- libuemf/uwmf_endian.c \
- libuemf/uwmf_endian.h \
- libuemf/uwmf_print.c \
- libuemf/uwmf_print.h \
- libuemf/upmf.c \
- libuemf/upmf.h \
- libuemf/upmf_print.c \
- libuemf/upmf_print.h \
- libuemf/symbol_convert.c \
- libuemf/symbol_convert.h
diff --git a/src/libuemf/uemf.h b/src/libuemf/uemf.h
index 82fd0990c..05566af06 100644
--- a/src/libuemf/uemf.h
+++ b/src/libuemf/uemf.h
@@ -168,12 +168,24 @@ extern "C" {
#define U_ROUND(A) ( (A) > 0 ? floor((A)+0.5) : ( (A) < 0 ? -floor(-(A)+0.5) : (A) ) )
#define MAKE_MIN_PTR(A,B) ( A < B ? A : B)
-/* This is tricky. The next one can be called with a size which is either an int or an unsigned int.
- The former can be negative, which is obviously wrong, but testing for that means that the size cannot
- be more than INT_MAX/2. Accept that limitation since no reasonable EMF record or file should ever be that large.
- B must be an INT or size_t.
- If a uint16_t is used gcc complains about the first test. Force B to be at least as big as int (at run time) */
-#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B)) < 0 ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 ))) //!< Return 1 when a region of memory starting at A of B bytes extends beyond pointer C
+
+/* IS_MEM_UNSAFE takes 3 parameters:
+ A start address of a block of allocated memory
+ B offset into this block starting at A
+ C address of final byte of a block of allocated memory.
+ Returns
+ 1 if B cannot be an int or size_t
+ 1 if C > A
+ 1 if A+B is not in the range A to C, inclusive
+ 0 otherwise.
+ B may be an int, an unsigned int, or a size_t. An int can be negative,
+ which is obviously wrong, but testing for that means that the size
+ of B cannot be more than INT_MAX/2. Accept that limitation since
+ no reasonable EMF record or file should ever be that large.
+ If B is a uint16_t gcc complains about the first test.
+ This Macro must not be used where B needs more than 32 bits!
+*/
+#define IS_MEM_UNSAFE(A,B,C) ( (sizeof(B) < sizeof(int) || (int)(B) < 0) ? 1 : ((int8_t *)(A) > (int8_t *)(C) ? 1 : ((int8_t *)(C) - (int8_t *)(A) >= (int)(B) ? 0 : 1 )))
/** @} */