mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Fix a memory-corruption bug in the line justification algorithm.
This commit is contained in:
parent
5ce3f23a2e
commit
4fe6e19dc6
3
AUTHORS
3
AUTHORS
@ -48,6 +48,9 @@ Andre Valente <a.valente@netcabo.pt>
|
||||
Download completion notify
|
||||
Portuguese and Brazilian-Portuguese translation updates
|
||||
|
||||
Andrzej Zaborowski <balrog@zabor.org>
|
||||
Fix for a memory-corruption bug in the line justification algorithm.
|
||||
|
||||
Anton Voloshin <vav@isv.ru>
|
||||
Proper encoding of form entries
|
||||
|
||||
|
@ -790,6 +790,7 @@ justify_line(struct html_context *html_context, int y)
|
||||
int pos;
|
||||
int *space_list;
|
||||
int spaces;
|
||||
int diff;
|
||||
|
||||
assert(html_context);
|
||||
if_assert_failed return;
|
||||
@ -839,8 +840,14 @@ justify_line(struct html_context *html_context, int y)
|
||||
|
||||
/* Realign line */
|
||||
|
||||
if (spaces > 1) {
|
||||
int diff = overlap(par_format) - len;
|
||||
/* Diff is the difference between the width of the paragraph
|
||||
* and the current length of the line. */
|
||||
diff = overlap(par_format) - len;
|
||||
|
||||
/* We check diff > 0 because diff can be negative (i.e., we have
|
||||
* an unbroken line of length > overlap(par_format))
|
||||
* even when spaces > 1 if the line has only non-breaking spaces. */
|
||||
if (spaces > 1 && diff > 0) {
|
||||
int prev_end = 0;
|
||||
int word;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user