diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-06-14 17:19:44 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-06-14 17:29:30 +0100 |
commit | d329d93bee0de067ce691814932ee11e5ec27d87 (patch) | |
tree | f4b41b01bb5cc520357a93b2866057f15f9cf4f6 /pdf/pdf_form.c | |
parent | 1e91d2dcb222bef831e85fc0b6e569b8f5436458 (diff) | |
download | mupdf-d329d93bee0de067ce691814932ee11e5ec27d87.tar.xz |
Fix problem in text_splitter (badly initialised max_lines)
Testing tests_private/v1.3/09+20anim+20fx-fo-dx-adr-mx.pdf with
mujstest shows an infinite loop due to an initialisation that
uses FLT_MAX rather than INT_MAX.
Even using INT_MAX still shows problems until a cast is added.
Diffstat (limited to 'pdf/pdf_form.c')
-rw-r--r-- | pdf/pdf_form.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c index 931a1dd4..dc00aae8 100644 --- a/pdf/pdf_form.c +++ b/pdf/pdf_form.c @@ -523,7 +523,10 @@ static void text_splitter_init(text_splitter *splitter, font_info *info, char *t splitter->height = height; splitter->fontsize = fontsize; splitter->scale = 1.0; - splitter->max_lines = variable ? height/fontsize : FLT_MAX; + /* RJW: The cast in the following line is important, as otherwise + * under MSVC in the variable = 0 case, splitter->max_lines becomes + * INT_MIN. */ + splitter->max_lines = variable ? (int)(height/fontsize) : INT_MAX; } static void text_splitter_start_pass(text_splitter *splitter) |