From: Michael D. Lowis Date: Fri, 18 Nov 2016 02:23:49 +0000 (-0500) Subject: Fixed an issue with drawing non ascii runes causing infinite loop X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=469066a924e0e3814ba5ffcf40d9cd46cb3eb7fc;p=projs%2Ftide.git Fixed an issue with drawing non ascii runes causing infinite loop --- diff --git a/inc/stdc.h b/inc/stdc.h index 29b8947..cbbcd57 100644 --- a/inc/stdc.h +++ b/inc/stdc.h @@ -147,6 +147,9 @@ static inline char* _getopt_(int* p_argc, char*** p_argv) { /* Error Handling *****************************************************************************/ +#define trace() \ + fprintf(stderr, "%s:%d\n", __FILE__, __LINE__) + #ifdef NDEBUG #define debug(msg, ...) \ ((void)0) diff --git a/xedit.c b/xedit.c index 44ded47..7473fb1 100644 --- a/xedit.c +++ b/xedit.c @@ -291,7 +291,7 @@ static void draw_runes(size_t x, size_t y, int fg, int bg, UGlyph* glyphs, size_ static void draw_glyphs(size_t x, size_t y, UGlyph* glyphs, size_t rlen, size_t ncols) { XGlyphSpec specs[rlen]; size_t i = 0; - while (rlen) { + while (rlen && i < ncols) { int numspecs = 0; uint32_t attr = glyphs[i].attr; while (i < ncols && glyphs[i].attr == attr) {