tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: chat/pidgin segfault with NetBSD 11 (fixed)



On Sun, Oct 05, 2025 at 05:35:22AM +0100, Anthony Mallet wrote:
> Shouldn't the warning -Wchar-subscripts be turned into an error, at
> least in pkgsrc? It seems to me like something has changed in
> NetBSD-11 and isspace(3), since pidgin has worked for me for a couple
> of decades with this issue. But maybe that's just the UB effect that
> suddenly decided to trigger...

See the discussion right above this thread in tech-pkg...

After applying this patch, I still see many more warnings of
the same type:

In file included from /usr/include/ctype.h:100,
                 from ../../libpurple/internal.h:85,
                 from log_reader.c:1:
log_reader.c: In function 'msn_logger_read':
log_reader.c:1001:64: warning: array subscript has type 'char' [-Wchar-subscripts]
 1001 |                                                       !isalnum(*(from_name + friendly_name_length))) ||
      |                                                                ^
log_reader.c:1003:64: warning: array subscript has type 'char' [-Wchar-subscripts]
 1003 |                                                       !isalnum(*(from_name + alias_length)));
      |                                                                ^
log_reader.c:1007:62: warning: array subscript has type 'char' [-Wchar-subscripts]
 1007 |                                                     !isalnum(*(to_name + friendly_name_length))) ||
      |                                                              ^
log_reader.c:1009:62: warning: array subscript has type 'char' [-Wchar-subscripts]
 1009 |                                                     !isalnum(*(to_name + alias_length))));
      |                                                              ^
log_reader.c:1027:70: warning: array subscript has type 'char' [-Wchar-subscripts]
 1027 |                                                         if (!isalnum(*temp)) {
      |                                                                      ^
log_reader.c:1041:74: warning: array subscript has type 'char' [-Wchar-subscripts]
 1041 |                                                                 !isalnum(*(from_name +
      |                                                                          ^
log_reader.c:1046:74: warning: array subscript has type 'char' [-Wchar-subscripts]
 1046 |                                                                 !isalnum(*(to_name +
      |                                                                          ^
log_reader.c:1070:82: warning: array subscript has type 'char' [-Wchar-subscripts]
 1070 |                                                                         !isalnum(*(from_name +
      |                                                                                  ^
log_reader.c:1076:82: warning: array subscript has type 'char' [-Wchar-subscripts]
 1076 |                                                                         !isalnum(*(to_name +
      |                                                                                  ^
In file included from /usr/include/ctype.h:100,
                 from lib/message.c:33:
lib/message.c: In function 'gg_message_html_to_text':
lib/message.c:697:44: warning: array subscript has type 'char' [-Wchar-subscripts]
  697 |                 if (in_entity && !(isalnum(*src) || *src == '#' || *src == ';')) {
      |                                            ^
lib/message.c:741:66: warning: array subscript has type 'char' [-Wchar-subscripts]
  741 |                                                 if (!isxdigit(tag[i])) {
      |                                                                  ^
lib/message.c:842:82: warning: array subscript has type 'char' [-Wchar-subscripts]
  842 |                                                                 if (!isxdigit(tag[i])) {
      |                                                                                  ^
lib/message.c:917:44: warning: array subscript has type 'char' [-Wchar-subscripts]
  917 |                 if (in_entity && !(isalnum(*src) || *src == '#'))
      |                                            ^

In file included from /usr/include/ctype.h:100,
                 from lib/handlers.c:29:
lib/handlers.c: In function 'gg_session_handle_welcome_110':
lib/handlers.c:120:70: warning: array subscript has type 'char' [-Wchar-subscripts]
  120 |         if (gs->client_version != NULL && !isdigit(gs->client_version[0])) {
      |                                                                      ^
lib/handlers.c: In function 'gg_session_handle_welcome':
lib/handlers.c:317:70: warning: array subscript has type 'char' [-Wchar-subscripts]
  317 |         if (gs->client_version != NULL && !isdigit(gs->client_version[0])) {
      |                                                                      ^
lib/handlers.c: In function 'gg_session_handle_recv_msg_110':
lib/handlers.c:1434:13: warning: absolute value function 'abs' given an argument of type 'time_t' {aka 'long int'} but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
 1434 |         if (abs(msg->time - gg_server_time(gs)) > 2)
      |             ^~~

In file included from /usr/include/ctype.h:100,
                 from lib/events.c:48:
lib/events.c: In function 'gg_handle_send_hub':
lib/events.c:877:73: warning: array subscript has type 'char' [-Wchar-subscripts]
  877 |         if (sess->client_version != NULL && isdigit(sess->client_version[0]))
      |                                                                         ^


(and more), so I guess your patches fixes a part of the problem, but
there are more.

Anyway, I've committed it as a first improvement.

Please make sure to report this upstream!

Cheers,
 Thomas


Home | Main Index | Thread Index | Old Index