From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS autolearn=no autolearn_force=no version=3.4.4 Received: from blvuug.org (hurricane.the-brannons.com [IPv6:2602:ff06:725:1:20::25]) by inbox.vuxu.org (Postfix) with ESMTP id 19C6E21303 for ; Fri, 5 Apr 2024 12:43:41 +0200 (CEST) Received: from hurricane (localhost.localdomain [127.0.0.1]) by blvuug.org (OpenSMTPD) with ESMTP id bdb35b2f for ; Fri, 5 Apr 2024 10:43:40 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by hurricane.the-brannons.com (OpenSMTPD) with ESMTPS id 6f7e54ae (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 5 Apr 2024 10:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1712313791; x=1712918591; i=shumenda@gmx.de; bh=tpLv0GAKaOpQj7y9UXc2ZpVfJINLsTv8T6HP2GcxPZU=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=WV8/Q7fcq9V/IztH22iOLloxJV8TNZCyZzZVkFHaNpPJ42uGVp69Tb/TSViswqwG EGQT23m1iRvtcmzl0nyblPieALNalP9b8bgM+IuJeb/QPi1hZfIIwS0xxRBGr6/QO oGdIECQGVhln/8VIdixyQebhylcC82hsXHqxcAYYjjOf8GNnMJZoLhkzNwQVkFHdO pjSM85YsNqfMoAomRlDowQ+BkOZk/7Ps4KdU3W8tk2gGLCwCZCwdasf4l3M0BH3uG BOVxttsgOyekqYBxP47VHmiLxm5qqZhurDozmBspcDUEHky+F8GPVCAH42whWtjKe a7WR80vW0rQqJkCT3Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from kraftkrust ([2.213.51.4]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJVHe-1s823r0gNE-00JtE4 for ; Fri, 05 Apr 2024 12:43:11 +0200 Date: Fri, 5 Apr 2024 12:43:09 +0200 From: Sebastian Humenda To: edbrowse-dev@edbrowse.org Subject: Re: uninitialized globals Message-ID: Mail-Followup-To: edbrowse-dev@edbrowse.org References: <20240305042901.eklhad@comcast.net> X-BeenThere: edbrowse-dev@edbrowse.org List-Id: Edbrowse Development List MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SqUvnG4il9ebxpVF" Content-Disposition: inline In-Reply-To: <20240305042901.eklhad@comcast.net> X-Provags-ID: V03:K1:b+WjEBbScVw0UOyW+lF+qiVE2AnQeRDcBjSmJPW9JKX0oeO6Kre FZItMYWAwR4Mrt8lRh3PeiVy9/vMkVIvWXPjA5YLzqszwKSucD1RpEZi3jR3Gi9ZVC4TPOh kDXDZ4V5RZgbwStoDX2wDfxE/O8MzIu+dGOWlvAXCuPoZTf+yESi0Ko4AYzpTrYltlX5gJr yR18zsxgn5h0y3OugNJqw== UI-OutboundReport: notjunk:1;M01:P0:Z43O1eKsSSc=;jT7lxfshRcTD2C2LJ0H/prduayV 55o07ux6+yN4uYYNZMcCZsOsMyCLLxQooLghYoh8cTpkemQ/xyevXQZjKbpACvStgl/HB17AJ 7NzvxrJotWyL6usqKzjkN6yqf7eHsIQJhFqBaQ3rP0+DfrLbVz4fleaiCE89CLTNunerL7xL1 zrbyoU8XxfuxUvb+Gi9n8uWLe71HRBzpSAx542PUFYrybH5l1khvxFHW83pegUCY+M2oNIs6r A8EocaeS47En6BhTLq7Zf5GQMUT5cJgIFXTNTYM3IfX32DMqsWJ6V3OukikfAlX6mJU6dqeLS FlQ9aVkMT47uqkDsDyX8nb9RCwJqGgAE14VpPWUYDlrauJ/jcCj4f/8YfwAIyEUMhakG4jJ5y NCosIe2QEsAH94BryvHHx5Ytw/h4sylwvvR431auDUZimy8UJPYiPOGaqO8DiPK23LRe/v/a7 FaLI8+z1QTk2guDwujY7FI+m4oo790uHKsh79dKdpPRTReRwlqyquw1O76DAEGeRjwh2CoGak SkrpsR/JG/uqdD6NNvCPFkvyoZVu1MMLkmCE6Hf3VUFcKmcwtUnNKXkWwQI2RFU5miM+cCsID 8Q5dhFxJYBgkH5DQPA6n8ANXL3d+HEhuNQU9aRyqoWWsSgOoIR7GRQIv+e3b+IkDzu7DxIFY5 M/yfIcWmXpNWFkUlNoDaiYKLUa+FDUTDbwu6/3zIeKshbijwUxWsPcAdS96bcLA5Y5PVQVgNC NE9+E9Ibl6NccS3H/q7g0SDhJ0pFtLyvcCc3EXBW3lzWloRFW05AQcuv/bxMFJWkAgrQ1dEeK N0Rk3IcMPCxGO8WPe9+xk1Vrd+rxMN6TF/MGXkWGPJkXM= --SqUvnG4il9ebxpVF Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Pardon, I should have sent it to the list. Karl Dahlke schrieb am 05.04.2024, 4:29 -0400: >the latest edbrowse 3.8.9 on Debian, compiled with GCC 12.2. It segfaults = on >startup, and the backtrace suggests it is in main.c:1926, where it nzFree's [=E2=80=A6] [=E2=80=A6] An excerpt of the build output is below this e-mail; it includes the build flags. >I am rather stunned by this. I have been using C since 1980. Ever since the >original K&R, global uninitialized variables are 0. I don't understand how [=E2=80=A6] I am bored by C standards and alike. I have been writing MISRA C for several years and I do remember the checkre requiring us to initialise explicitly every static (i.e. global) as its initialisation was either depending on the type or implementation defined, I do not recall. Here is what nm says: % nm src/edbrowse | grep 'sslCerts' 0000000000247088 D sslCerts % nm src/edbrowse | fgrep allowJS % nm src/edbrowse | fgrep allowJS 0000000000247079 D allowJS >but that's not simple because there are dozens of global variables, and so= me >static variables too, that are not initialized, that I count on being zero. >If we got past sslCerts we would just run into another one. We'd have to [=E2=80=A6] Agreed. I actually just looked whether I can call up my.test.website and wi= th this set, it worked :). I actually was trying out the QuicJS support. Cheers Sebastian =3D=3D=3D Build Output cc -g -O2 -ffile-prefix-map=3D/tmp/edbrowse=3D. -fstack-protector-strong -W= format -Werror=3Dformat-security -Wall -Wno-unused -D_FILE_OFFSET_BITS=3D64= -DEDBROWSE_ON_LINUX -I/usr/include/x86_64-linux-gnu -g -ggdb -Wextra -Wda= te-time -D_FORTIFY_SOURCE=3D2 -c -o dbodbc.o dbodbc.c isup.c: In function =E2=80=98decodePostData=E2=80=99: isup.c:1276:30: warning: =E2=80=98c=E2=80=99 may be used uninitialized [-Wm= aybe-uninitialized] 1276 | *w++ =3D c; | ~~~~~^~~ isup.c:1230:14: note: =E2=80=98c=E2=80=99 was declared here 1230 | char c; | ^ css.c: In function =E2=80=98hashSortCrunch=E2=80=99: css.c:3222:37: warning: =E2=80=98j=E2=80=99 may be used uninitialized [-Wma= ybe-uninitialized] 3222 | mark->body[j++] =3D v->t; | ~^~ css.c:3202:16: note: =E2=80=98j=E2=80=99 was declared here 3202 | int i, j, distinct =3D 0; | ^ css.c: In function =E2=80=98do_rules=E2=80=99: css.c:3106:9: warning: =E2=80=98tn=E2=80=99 may be used uninitialized [-Wma= ybe-uninitialized] 3106 | set_property_bool_t(tn, "inj$css", true); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ css.c:2957:20: note: =E2=80=98tn=E2=80=99 was declared here 2957 | const Tag *tn; // the text node that holds before or after = text | ^~ dbops.c: In function =E2=80=98stringDate=E2=80=99: dbops.c:505:17: warning: =E2=80=98__builtin_strncpy=E2=80=99 output may be = truncated copying 4 bytes from a string of length 7 [-Wstringop-truncation] 505 | strncpy(buf, buf + 4, 4); | ^ dbodbc.c: In function =E2=80=98retsFromOdbc=E2=80=99: dbodbc.c:937:30: warning: =E2=80=98input_length=E2=80=99 may be used uninit= ialized [-Wmaybe-uninitialized] 937 | rc =3D SQLGetData(hstmt, (ushort) (i + 1), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 938 | c_type, q1, input_length, | ~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | &output_length); | ~~~~~~~~~~~~~~~ dbodbc.c:827:14: note: =E2=80=98input_length=E2=80=99 was declared here 827 | long input_length, output_length; | ^~~~~~~~~~~~ dbodbc.c:937:30: warning: =E2=80=98c_type=E2=80=99 may be used uninitialize= d [-Wmaybe-uninitialized] 937 | rc =3D SQLGetData(hstmt, (ushort) (i + 1), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 938 | c_type, q1, input_length, | ~~~~~~~~~~~~~~~~~~~~~~~~~ 939 | &output_length); | ~~~~~~~~~~~~~~~ dbodbc.c:826:15: note: =E2=80=98c_type=E2=80=99 was declared here 826 | short c_type; /* C data type */ | ^~~~~~ dbops.c: In function =E2=80=98stringTime=E2=80=99: dbops.c:636:28: warning: =E2=80=98c=E2=80=99 may be used uninitialized [-Wm= aybe-uninitialized] 636 | if (c =3D=3D 'A') | ^ dbops.c:593:14: note: =E2=80=98c=E2=80=99 was declared here 593 | char c; | ^ css.c: In function =E2=80=98cssParseLeft=E2=80=99: css.c:1336:52: warning: =E2=80=98sel2=E2=80=99 may be used uninitialized [-= Wmaybe-uninitialized] 1336 | sel2->next =3D sel, sel2 = =3D sel; | ~~~~~~~~~~~^~~~~ css.c:1258:21: note: =E2=80=98sel2=E2=80=99 was declared here 1258 | struct sel *sel2; | ^~~~ dbodbc.c: In function =E2=80=98oneRetValue.constprop=E2=80=99: dbodbc.c:1114:19: warning: =E2=80=98f=E2=80=99 may be used uninitialized [-= Wmaybe-uninitialized] 1114 | n =3D f; | ~~^~~ dbodbc.c:1097:16: note: =E2=80=98f=E2=80=99 was declared here 1097 | double f; | ^ dbodbc.c:1126:19: warning: =E2=80=98c=E2=80=99 may be used uninitialized [-= Wmaybe-uninitialized] 1126 | n =3D c; | ~~^~~ dbodbc.c:1095:14: note: =E2=80=98c=E2=80=99 was declared here 1095 | char c; | ^ dbodbc.c:1133:16: warning: =E2=80=98n=E2=80=99 may be used uninitialized [-= Wmaybe-uninitialized] 1133 | return n; | ^ dbodbc.c:1096:14: note: =E2=80=98n=E2=80=99 was declared here 1096 | long n; | ^ dbops.c: In function =E2=80=98lineFormatStack=E2=80=99: dbops.c:191:40: warning: =E2=80=98dn=E2=80=99 may be used uninitialized [-W= maybe-uninitialized] 191 | (pdir =3D=3D 'f' && dn =3D=3D nullfloat) || dbops.c:101:16: note: =E2=80=98dn=E2=80=99 was declared here 101 | double dn; /* double number */ | ^~ dbops.c:189:37: warning: =E2=80=98n=E2=80=99 may be used uninitialized [-Wm= aybe-uninitialized] 189 | if ((pdir =3D=3D 'c' && !n) || | ^~ dbops.c:100:14: note: =E2=80=98n=E2=80=99 was declared here 100 | long n; | ^ css.c: In function =E2=80=98cssPieces=E2=80=99: css.c:1008:42: warning: =E2=80=98d2=E2=80=99 may be used uninitialized [-Wm= aybe-uninitialized] 1008 | d2->next =3D d, d2 =3D d; | ~~~~~~~~~^~~ css.c:802:31: note: =E2=80=98d2=E2=80=99 was declared here 802 | struct desc *d1 =3D 0, *d2, *d =3D 0; | ^~ In function =E2=80=98uncomment=E2=80=99, inlined from =E2=80=98cssPieces=E2=80=99 at css.c:815:2: css.c:176:56: warning: =E2=80=98url0=E2=80=99 may be used uninitialized [-W= maybe-uninitialized] 176 | *w++ =3D *u; | ^~ css.c: In function =E2=80=98cssPieces=E2=80=99: css.c:147:23: note: =E2=80=98url0=E2=80=99 was declared here 147 | char *w =3D s, *url0; | ^~~~ cc -I/usr/include/quickjs -Wdate-time -D_FORTIFY_SOURCE=3D2 -g -O2 -ffile-p= refix-map=3D/tmp/edbrowse=3D. -fstack-protector-strong -Wformat -Werror=3Df= ormat-security -Wall -Wno-unused -D_FILE_OFFSET_BITS=3D64 -DEDBROWSE_ON_LIN= UX -I/usr/include/x86_64-linux-gnu -g -ggdb -Wextra -c jseng-quick.c In function =E2=80=98cursor_comm=E2=80=99, inlined from =E2=80=98syncup_table=E2=80=99 at dbops.c:2051:2: dbops.c:1945:31: warning: =E2=80=98sortval2=E2=80=99 may be used uninitiali= zed [-Wmaybe-uninitialized] 1943 | ((sorttype =3D=3D 'S' | ~~~~~~~~~~~~~~~~~ 1944 | && strcmp(sortstring1, sortstring2) = < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ 1945 | || (sorttype !=3D 'S' && sortval1 < s= ortval2)))) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~ dbops.c: In function =E2=80=98syncup_table=E2=80=99: dbops.c:1835:23: note: =E2=80=98sortval2=E2=80=99 was declared here 1835 | int sortval1, sortval2; | ^~~~~~~~ In function =E2=80=98cursor_comm=E2=80=99, inlined from =E2=80=98syncup_table=E2=80=99 at dbops.c:2051:2: dbops.c:1945:31: warning: =E2=80=98sortval1=E2=80=99 may be used uninitiali= zed [-Wmaybe-uninitialized] 1943 | ((sorttype =3D=3D 'S' | ~~~~~~~~~~~~~~~~~ 1944 | && strcmp(sortstring1, sortstring2) = < 0) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ 1945 | || (sorttype !=3D 'S' && sortval1 < s= ortval2)))) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~ dbops.c: In function =E2=80=98syncup_table=E2=80=99: dbops.c:1835:13: note: =E2=80=98sortval1=E2=80=99 was declared here 1835 | int sortval1, sortval2; | ^~~~~~~~ css.c: In function =E2=80=98qsaMatch=E2=80=99: css.c:2387:28: warning: =E2=80=98rc=E2=80=99 may be used uninitialized [-Wm= aybe-uninitialized] 2387 | if (rc) | ^ css.c:2100:14: note: =E2=80=98rc=E2=80=99 was declared here 2100 | bool rc; | ^~ In file included from /usr/include/quickjs/quickjs-libc.h:30, from jseng-quick.c:18: /usr/include/quickjs/quickjs.h: In function =E2=80=98JS_NewCFunctionMagic= =E2=80=99: /usr/include/quickjs/quickjs.h:969:34: warning: cast between incompatible f= unction types from =E2=80=98JSValue (*)(JSContext *, JSValue, int, JSValu= e *, int)=E2=80=99 to =E2=80=98JSValue (*)(JSContext *, JSValue, int, JSV= alue *)=E2=80=99 [-Wcast-function-type] 969 | return JS_NewCFunction2(ctx, (JSCFunction *)func, name, length,= cproto, magic); | ^ cc -g -O2 -ffile-prefix-map=3D/tmp/edbrowse=3D. -fstack-protector-strong -W= format -Werror=3Dformat-security -Wall -Wno-unused -D_FILE_OFFSET_BITS=3D64= -DEDBROWSE_ON_LINUX -I/usr/include/x86_64-linux-gnu -g -ggdb -Wextra -Wda= te-time -D_FORTIFY_SOURCE=3D2 -c -o ebrc.o ebrc.c cc -g -O2 -ffile-prefix-map=3D/tmp/edbrowse=3D. -fstack-protector-strong -W= format -Werror=3Dformat-security -Wall -Wno-unused -D_FILE_OFFSET_BITS=3D64= -DEDBROWSE_ON_LINUX -I/usr/include/x86_64-linux-gnu -g -ggdb -Wextra -Wda= te-time -D_FORTIFY_SOURCE=3D2 -c -o msg-strings.o msg-strings.c jseng-quick.c: In function =E2=80=98setup_window_2=E2=80=99: jseng-quick.c:3787:9: warning: ignoring return value of =E2=80=98asprintf= =E2=80=99 declared with attribute =E2=80=98warn_unused_result=E2=80=99 [-Wu= nused-result] 3787 | asprintf(&wpc, "Wp`Set@%s", cf->fileName); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ jseng-quick.c: In function =E2=80=98set_basehref=E2=80=99: jseng-quick.c:4448:17: warning: ignoring return value of =E2=80=98asprintf= =E2=80=99 declared with attribute =E2=80=98warn_unused_result=E2=80=99 [-Wu= nused-result] 4448 | asprintf(&wpc, "Wp`Set@%s", h); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc -g -O2 -ffile-prefix-map=3D/tmp/edbrowse=3D. -fstack-protector-strong -W= format -Werror=3Dformat-security -Wall -Wno-unused -D_FILE_OFFSET_BITS=3D64= -DEDBROWSE_ON_LINUX -I/usr/include/x86_64-linux-gnu -g -ggdb -Wextra -Wda= te-time -D_FORTIFY_SOURCE=3D2 -c -o startwindow.o startwindow.c jseng-quick.c: In function =E2=80=98embedNodeName=E2=80=99: jseng-quick.c:2012:17: warning: =E2=80=98__builtin___strncpy_chk=E2=80=99 s= pecified bound depends on the length of the source argument [-Wstringop-tru= ncation] 2012 | strncpy(b, nodeName, length); | ^ jseng-quick.c:2009:26: note: length computed here 2009 | length =3D strlen(nodeName); | ^~~~~~~~~~~~~~~~ cc main.o buffers.o sendmail.o fetchmail.o html.o html-tags.o format.o stri= ngfile.o ebrc.o msg-strings.o http.o isup.o css.o startwindow.o dbops.o dbo= dbc.o jseng-quick.o /usr/lib/x86_64-linux-gnu/quickjs/libquickjs.a -ldl -la= tomic -Wl,-z,relro -Wl,-z,now -lcurl -lodbc -lpcre2-8 -lreadline -lssl -lc= rypto -lpthread -lm -lssl -lcrypto -o edbrowse --SqUvnG4il9ebxpVF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEDdK8MMbHMms/+s0k2/EkeQsw7KUFAmYP1bwACgkQ2/EkeQsw 7KWpqw//e0tYC80rkncBa85HaHd5PUq3NvBQUWw9DbbTg5mt5Ps3CaDMod1wRtU5 ZA/QNDHmBlS9py3+Li9sp82JyN0qmlm90iyfGWW6EQNQlczHCzzeGH1Ale+rL/5k kTPHshBrlb6nQhdP6xEsoDZV4O5tNcpr+ulyhgdAayKSStETx71g6jfM+VnUYlZa pPhCuICVGody920OKfzgtQ2jDsYKLRZaf2XteU2e6TacYQ1h5eFw+eKhDEkHtIxU VuVmMZXgrrB3HtKO/Aku05Kd1E8e2Wy5heUNnQ/tfSiiq2y/pl1/3973rMDIUXkF DanhSHkhYcINuTjmJdmKcmDMCGAvkn8BM+iNxC/c8lT2dDVjgjjDxr/o1pDEdY2m o2sxRk91h41L1Q0GTbd+GeCdZ60bhMnji2t0hbf/egzaoiGf1xcfUNaBnSrZ5Syx 3yvTfyL2Xl+Jhll8Ydn9b/+oMiDweOVnu+ATwLOKnUTd1eOovAIO5SbB9KmPNBAB 94aRXq3DNfYZSC6JTb14DC5wZylLRUvU73DiJxCE3GtBXw2cDPz7uMPzxuhzTXx5 c/YMonZmOG/XfkdRK2pItWdn7yUeX9Q/C1ghbi8+CEx7HIrEJcl59e8+UmVN9kj+ OSxxokQaRsSxHX6g5Mxztq+Wpl0K5s0b0v/bAV5jR75r3mvZXxU= =jSMW -----END PGP SIGNATURE----- --SqUvnG4il9ebxpVF--