slang-users mailing list

[2023 Date Index] [2023 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Serious issue with 'SLcurses_Acs_Map'


Hello list, anybody here?

While compiling on Win-10 using clang-cl,
I got a bunch of these serious warnings:
slcurses.c(388,8): warning: array index 218 is past the end of the array (that has type 'SLcurses_Char_Type[128]' (aka 'unsigned long[128]'))
        [-Warray-bounds]
         SLcurses_Acs_Map[SLSMG_ULCORN_CHAR] = SLSMG_ULCORN_CHAR | A_ALTCHARSET;
         ^                ~~~~~~~~~~~~~~~~~
  slcurses.c(63,1): note: array 'SLcurses_Acs_Map' declared here
  SLcurses_Char_Type SLcurses_Acs_Map [128];
  ^
  ...

For a 'IBMPC_SYSTEM' system, these indices extend up to
'SLSMG_BLOCK_CHAR' == 0xDB. Hence 128 is too small.

This is how I patched away this warning:

--- a/slang.h 2023-04-24 12:06:52
+++ b/slang.h 2023-04-24 12:32:56
@@ -1885,6 +1885,7 @@
 # define SLSMG_UARROW_CHAR	0x18
 # define SLSMG_BOARD_CHAR	0xB2
 # define SLSMG_BLOCK_CHAR	0xDB
+# define ACS_MAP_SIZE       256
 #else
 # if defined(AMIGA)
 #  define SLSMG_HLINE_CHAR	((unsigned char)'-')
@@ -1933,6 +1934,7 @@
 #  define SLSMG_BOARD_CHAR	((unsigned char)'h')
 #  define SLSMG_BLOCK_CHAR	((unsigned char)'0')
 # endif				       /* AMIGA */
+# define ACS_MAP_SIZE       128
 #endif				       /* IBMPC_SYSTEM */

 #ifndef IBMPC_SYSTEM

--- a/slcurses.c 2022-03-18 06:56:08
+++ b/slcurses.c 2023-04-24 12:33:15
@@ -60,7 +60,7 @@

 SLcurses_Window_Type *SLcurses_Stdscr;
 int SLcurses_Esc_Delay = 150;	       /* 0.15 seconds */
-SLcurses_Char_Type SLcurses_Acs_Map [128];
+SLcurses_Char_Type SLcurses_Acs_Map [ACS_MAP_SIZE];
 int SLcurses_Is_Endwin = 1;
 int SLcurses_Num_Colors = 8;

--- a/slcurses.h 2022-10-08 10:11:24
+++ b/slcurses.h 2023-04-24 12:33:06
@@ -246,7 +246,7 @@
    (w)->scroll_max=(w)->nrows, \
    wscrl((w), -1))

-SL_EXTERN SLcurses_Char_Type SLcurses_Acs_Map [128];
+SL_EXTERN SLcurses_Char_Type SLcurses_Acs_Map [ACS_MAP_SIZE];
 #define acs_map SLcurses_Acs_Map



--
--gv
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2023 date index] [2023 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]