diff options
Diffstat (limited to 'macros/texinfo/texinfo/info/info-utils.c')
-rw-r--r-- | macros/texinfo/texinfo/info/info-utils.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/macros/texinfo/texinfo/info/info-utils.c b/macros/texinfo/texinfo/info/info-utils.c index 63a2897e53..e692183020 100644 --- a/macros/texinfo/texinfo/info/info-utils.c +++ b/macros/texinfo/texinfo/info/info-utils.c @@ -1,6 +1,6 @@ /* info-utils.c -- miscellanous. - Copyright 1993-2019 Free Software Foundation, Inc. + Copyright 1993-2020 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 @@ -988,21 +988,20 @@ copy_input_to_output (long n) if (anchor_to_adjust) { - char *first_anchor = input_start - + (*anchor_to_adjust)->nodestart - node_offset; + /* Check there is an anchor in the input. */ + long first_anchor = + (*anchor_to_adjust)->nodestart - node_offset; - /* If there is an anchor in the input: */ - if (first_anchor < inptr + bytes_left) + if (first_anchor < 0) + anchor_to_adjust = 0; /* error in input file */ + else if (first_anchor < (inptr-input_start) + bytes_left) { /* Convert enough to pass the first anchor in input. */ - bytes_to_convert = first_anchor - inptr + 1; - - /* Shouldn't happen because we should have already - have adjusted this anchor. */ + bytes_to_convert = first_anchor - (inptr-input_start)+1; if (bytes_to_convert < 0) { - anchor_to_adjust = 0; /* Abandon anchor adjustment.*/ bytes_to_convert = bytes_left; + anchor_to_adjust = 0; } } } @@ -1325,7 +1324,8 @@ scan_reference_label (REFERENCE *entry, int in_index) entry->end = inptr - input_start; /* Colon after label. */ - skip_input (1); + if (*inptr) + skip_input (1); /* Don't mess up the margin of a menu description. */ if (entry->type == REFERENCE_MENU_ITEM) write_extra_bytes_to_output (" ", 1); |