Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rsSlz-007EHJ-Qm for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 19:29:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rsSlz-00CLcY-1I for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 19:29:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rsSly-00CLcN-NL for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 19:29:18 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rsSlt-000egJ-Se for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 19:29:17 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-516c116f480so1898063e87.2 for ; Thu, 04 Apr 2024 12:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1712258952; x=1712863752; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yrt69MgnoCN45s9XUS2j9X/2TywkEwpD0diaq/10yQU=; b=ElQ7lMF8o6sgAIvWlkqLBn98QQU85a7HP8ijcUULkAeSS8Kmz3sH2Kh5iB5Yz/w1Pk VTFVphdR7JNycxr7x4/qtzYQC+JDvfXSMMlfHPhdYhr2Jo84tvAImHKvulxcFoRDz66e KTSG+2bG3fnueYiFaoPXF/GAy4URVcV8HPGU7rhltTHM81xQIFAd8QO9KHFP0rVy3iQg t9WslVQFkZzLlvOBrFJYuJI2xKCd0kTUzJ51EDqirlT90m0wPah2+70QXiaeRE8beCi7 HJougzcgH9fcc0cEygglCx5zN4hnICmxKQTXCb3yYosUpcycO9xwa8q3P7twgTITHcIl +sCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712258952; x=1712863752; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yrt69MgnoCN45s9XUS2j9X/2TywkEwpD0diaq/10yQU=; b=N+4iIvDdFLc+6BRynfba5dTLGnpblD0gkGAC0iDVq+ECfis023ZcBwuFbliDlgL6qu adTOjph0fwwzlEq1ZeCGulytaPqzn6GH0h6G3/8Asbqt3zSz9VHTKlTPmWPDWiYqSjos qROEySWzOau3LywHGwigBX3G1UzaDGF43eSEvZaY9HeX9Qpe3pPEDR+ygkwjoB+d0M4y FTUNk1DgzkZawLU/RBCpPM7sT+Xi4vrZPkLaGjEOrHw6F+w9KGONUD3HpLB4zisGMN1u +sj8v+pQ5jkm890wqYIbJdyFIfKDbn05C7OfFG58AkPN65aJmaRi6363maOudMkwk6gI 1uJQ== X-Forwarded-Encrypted: i=1; AJvYcCWHi+TMj4Sq8Tdu7vFfNflRmpgd8QMaYrMUxKQnHnS63wvwjkQCoi5MY5FGpbskDC3dbf0nkBB0fTU1JbvtdmMeesq0La3MljD/PBsvYBmscblv X-Gm-Message-State: AOJu0Yz1ZZ1IYSBVBZ90NpOxP5leern9/Lq/lzrTxm1fnSPYiVrxsZUj yXvPuabTCqEmU+cfADUM6ksuxcMMDtwRGao6ckNhO8RP1D1W9RcQG0zHmF0DIVJW0kk/W4opaaV 96adIE8fnrg7B+pcuZHyV5yiYLz/doz2yAeHW X-Google-Smtp-Source: AGHT+IF4PsK3kUGr9ILrotaz1XkhQrVQzA0mKi0bWxPcl/MW9vbj0dySpv3Qzz8ZXVj1+WC1wDSQYHowym7FfPYd3dw= X-Received: by 2002:ac2:5a4d:0:b0:515:a733:2e21 with SMTP id r13-20020ac25a4d000000b00515a7332e21mr2225935lfn.44.1712258951686; Thu, 04 Apr 2024 12:29:11 -0700 (PDT) MIME-Version: 1.0 References: <7ead3d4d-ddc6-2499-0a04-6b29c693ea4a@dunslane.net> <8447d168-b981-2601-8ad0-53827fe18e5a@dunslane.net> <158c19a9-f092-4f37-b555-2b5c5f85ffd8@dunslane.net> <549100.1712242815@sss.pgh.pa.us> <562157.1712243788@sss.pgh.pa.us> <606171.1712246685@sss.pgh.pa.us> <40e7a22a-426f-4c53-9720-b51a81d81202@dunslane.net> <20240404180602.GA3878309@nathanxps13> In-Reply-To: <20240404180602.GA3878309@nathanxps13> From: Jacob Champion Date: Thu, 4 Apr 2024 12:28:59 -0700 Message-ID: Subject: Re: WIP Incremental JSON Parser To: Nathan Bossart , Andrew Dunstan Cc: Jelte Fennema-Nio , Tom Lane , Amit Langote , Robert Haas , Peter Smith , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 4, 2024 at 11:06=E2=80=AFAM Nathan Bossart wrote: > ../postgresql/src/common/jsonapi.c: In function =E2=80=98IsValidJsonNumbe= r=E2=80=99: > ../postgresql/src/common/jsonapi.c:2016:30: error: =E2=80=98dummy_lex.inc= _state=E2=80=99 may be used uninitialized in this function [-Werror=3Dmaybe= -uninitialized] > 2016 | if (lex->incremental && !lex->inc_state->is_last_chunk && > | ~~~^~~~~~~~~~~ > ../postgresql/src/common/jsonapi.c:2020:36: error: =E2=80=98dummy_lex.tok= en_start=E2=80=99 may be used uninitialized in this function [-Werror=3Dmay= be-uninitialized] > 2020 | lex->token_start, s - lex->token_start); > | ~~~^~~~~~~~~~~~~ Ah, it hasn't figured out that the incremental path is disabled. Zero-initializing the dummy_lex would be good regardless. > ../postgresql/src/common/jsonapi.c:302:26: error: =E2=80=98numeric_error= =E2=80=99 may be used uninitialized in this function [-Werror=3Dmaybe-unini= tialized] > 302 | return (!numeric_error) && (total_len =3D=3D dummy_lex.input_len= gth); > | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For this case, though, I think it'd be good for API consistency if *numeric_error were always set on return, instead of relying on the caller to initialize. --Jacob