Skip to content

Commit ee77825

Browse files
committed
Fix a crash bug with bogus text (Issue #426)
1 parent a0014be commit ee77825

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Fixed a crash bug with malformed URIs (Issue #418)
99
- Fixed a crash bug with malformed GIF files (Issue #423)
1010
- Fixed a crash bug with empty titles (Issue #425)
11+
- Fixed a crash bug with bogus text (Issue #426)
1112
- Fixed some issues reported by Coverity.
1213
- Removed the bundled libjpeg, libpng, and zlib.
1314

htmldoc/html.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* HTML exporting functions for HTMLDOC, a HTML document processing program.
33
*
4-
* Copyright 2011-2019 by Michael R Sweet.
4+
* Copyright 2011-2021 by Michael R Sweet.
55
* Copyright 1997-2010 by Easy Software Products. All rights reserved.
66
*
77
* This program is free software. Distribution and use rights are outlined in
@@ -585,7 +585,7 @@ write_node(FILE *out, /* I - Output file */
585585
for (ptr = t->data; *ptr; ptr ++)
586586
fputs((char *)iso8859(*ptr), out);
587587

588-
if (t->data[strlen((char *)t->data) - 1] == '\n')
588+
if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
589589
col = 0;
590590
else
591591
col += strlen((char *)t->data);

htmldoc/htmllib.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ write_file(tree_t *t, /* I - Tree entry */
16021602
for (ptr = t->data; *ptr != '\0'; ptr ++)
16031603
fputs((char *)iso8859(*ptr), fp);
16041604

1605-
if (t->data[strlen((char *)t->data) - 1] == '\n')
1605+
if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
16061606
col = 0;
16071607
else
16081608
col += strlen((char *)t->data);

htmldoc/htmlsep.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ write_node(FILE *out, /* I - Output file */
591591
for (ptr = t->data; *ptr; ptr ++)
592592
fputs((char *)iso8859(*ptr), out);
593593

594-
if (t->data[strlen((char *)t->data) - 1] == '\n')
594+
if (t->data[0] && t->data[strlen((char *)t->data) - 1] == '\n')
595595
col = 0;
596596
else
597597
col += strlen((char *)t->data);

0 commit comments

Comments
 (0)