Fix bidi-line-level-loop boundaries - libgrapheme - unicode string library
 (HTM) git clone git://git.suckless.org/libgrapheme
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a17b629bb30ac9c0e3e7343449dc42085bb2fc59
 (DIR) parent ba923230c7b25b0737d151c3f607a75b63676456
 (HTM) Author: Laslo Hunhold <dev@frign.de>
       Date:   Mon, 29 May 2023 10:34:37 +0200
       
       Fix bidi-line-level-loop boundaries
       
       The first change was caught using dynamic code analysis and prevents
       access to uninitialized memory (it wouldn't be worse than that, though,
       given we do not access memory we are not allowed to and the consequences
       are harmless).
       
       The second change was found by eyesight.
       
       Signed-off-by: Laslo Hunhold <dev@frign.de>
       
       Diffstat:
         M src/bidirectional.c                 |       4 ++--
       
       1 file changed, 2 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/bidirectional.c b/src/bidirectional.c
       @@ -1527,7 +1527,7 @@ get_line_embedding_levels(const uint_least32_t *linedata, size_t linelen,
                         * we hit the end of the line but were in a run;
                         * reset the line levels to the paragraph level
                         */
       -                for (i = runsince; i < MIN(linelen, levsize); i++) {
       +                for (i = runsince; i < MIN(linelen, levlen); i++) {
                                if (get_level(lev, i) != -1) {
                                        set_level(lev, i, runlevel);
                                }
       @@ -1624,7 +1624,7 @@ grapheme_bidirectional_reorder_line(const uint_least32_t *line,
                 * output
                 */
                get_line_embedding_levels(linedata, linelen, get_level_uint32,
       -                                  set_level_uint32, output, linelen, true);
       +                                  set_level_uint32, output, outputsize, true);
        
                /* determine level range */
                for (i = 0; i < outputlen; i++) {