From d329d93bee0de067ce691814932ee11e5ec27d87 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 14 Jun 2012 17:19:44 +0100 Subject: 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. --- pdf/pdf_form.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3