mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-29 06:15:23 -04:00
- raster.c: Need ceilf(symbol->height * si) to avoid heap-buffer-overflow;
also avoid distributive multiplication with floats to lessen chances of platform variation (#204 ARM-Cortex crash) - raster.c: Don't allow for text if scale < 1.0 - raster.c: Cast some indexes to (size_t) to allow for large scale - vector.c: Check malloc()s and return ZINT_ERROR_MEMORY on fail - raster/vector.c: various var name changes & other code fiddling - library.c: Check that scale/height/whitespace/border are reasonable values: scale (0.01-100), height (0-500), whitespace_width/height (0-100), border_width (0-100) - CLI: allow both e.g. '-height' and '--height' (getopt_long_only()) - gif.c: fix GIF_ZLW_PAGE_SIZE -> GIF_LZW_PAGE_SIZE - GUI: allow whitespace/scale to 100
This commit is contained in:
parent
5766b39845
commit
9bae0b86f9
19 changed files with 870 additions and 814 deletions
|
@ -41,8 +41,8 @@
|
|||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
/* Limit initial ZLW buffer size to this in expectation that compressed data will fit for typical scalings */
|
||||
#define GIF_ZLW_PAGE_SIZE 0x100000 /* Megabyte */
|
||||
/* Limit initial LZW buffer size to this in expectation that compressed data will fit for typical scalings */
|
||||
#define GIF_LZW_PAGE_SIZE 0x100000 /* Megabyte */
|
||||
|
||||
typedef struct s_statestruct {
|
||||
unsigned char *pOut;
|
||||
|
@ -98,7 +98,7 @@ static int BufferNextByte(statestruct *pState) {
|
|||
}
|
||||
if (pState->OutPosCur >= pState->OutLength) {
|
||||
unsigned char *pOut;
|
||||
pState->OutLength += GIF_ZLW_PAGE_SIZE;
|
||||
pState->OutLength += GIF_LZW_PAGE_SIZE;
|
||||
/* Note pState->pOut not free()d by realloc() on failure */
|
||||
if (!(pOut = (unsigned char *) realloc(pState->pOut, pState->OutLength))) {
|
||||
return 1;
|
||||
|
@ -309,8 +309,8 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
|
|||
|
||||
/* Allow for overhead of 4 == code size + byte count + overflow byte + zero terminator */
|
||||
unsigned int lzoutbufSize = bitmapSize + 4;
|
||||
if (lzoutbufSize > GIF_ZLW_PAGE_SIZE) {
|
||||
lzoutbufSize = GIF_ZLW_PAGE_SIZE;
|
||||
if (lzoutbufSize > GIF_LZW_PAGE_SIZE) {
|
||||
lzoutbufSize = GIF_LZW_PAGE_SIZE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue