pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH for review


From: John Darrington
Subject: PATCH for review
Date: Fri, 24 Mar 2017 17:47:42 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

This fix avoids a bug where the driver would enter a tight loop when rendering 
cells
with zero height or width.
---
 NEWS              |  3 +++
 src/output/html.c | 10 ++++++----
 tests/automake.mk |  1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 5085b1fa..141723b7 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ Please send PSPP bug reports to address@hidden
 
 Changes from 0.10.2 to 0.10.4:
 
+ * A bug which could cause the HTML driver to go into a tight loop
+   has been fixed.
+
  * An error in the FREQUENCIES procedure, where the word "Mean" was
    printed when "Variance" was appropriate has been fixed.
 
diff --git a/src/output/html.c b/src/output/html.c
index 8b16ffa7..fd6d40d1 100644
--- a/src/output/html.c
+++ b/src/output/html.c
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012, 2013, 2014 Free 
Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2009, 2010, 2011, 2012, 2013, 2014, 2017 Free 
Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -407,7 +407,6 @@ html_output_table (struct html_driver *html, const struct 
table_item *item)
   for (y = 0; y < table_nr (t); y++)
     {
       int x;
-
       for (x = 0; x < table_nc (t); )
         {
           const struct cell_contents *c;
@@ -415,7 +414,7 @@ html_output_table (struct html_driver *html, const struct 
table_item *item)
 
           table_get_cell (t, x, y, &cell);
           if (y != cell.d[TABLE_VERT][0])
-            continue;
+            goto next_0;
 
           for (c = cell.contents; c < &cell.contents[cell.n_contents]; c++)
             {
@@ -432,6 +431,8 @@ html_output_table (struct html_driver *html, const struct 
table_item *item)
                                  strlen (c->footnotes[i]), " ", "<BR>");
                 }
             }
+
+       next_0:
           x = cell.d[TABLE_HORZ][1];
           table_cell_free (&cell);
         }
@@ -465,7 +466,7 @@ html_output_table (struct html_driver *html, const struct 
table_item *item)
 
           table_get_cell (t, x, y, &cell);
           if (x != cell.d[TABLE_HORZ][0] || y != cell.d[TABLE_VERT][0])
-            continue;
+            goto next_1;
 
           /* Output <TD> or <TH> tag. */
           is_header = (y < table_ht (t)
@@ -570,6 +571,7 @@ html_output_table (struct html_driver *html, const struct 
table_item *item)
           /* Output </TH> or </TD>. */
           fprintf (html->file, "</%s>\n", tag);
 
+       next_1:
           x = cell.d[TABLE_HORZ][1];
           table_cell_free (&cell);
         }
diff --git a/tests/automake.mk b/tests/automake.mk
index 0fe8a5f6..93b19d82 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -394,6 +394,7 @@ TESTSUITE_AT = \
        tests/math/randist.at \
        tests/output/ascii.at \
        tests/output/charts.at \
+       tests/output/html.at \
        tests/output/output.at \
        tests/output/paper-size.at \
        tests/output/render.at \
-- 
2.11.0


-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]