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 1u6wM1-008BMl-Ci for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Apr 2025 18:58:53 +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 1u6wLz-007pQT-3E for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Apr 2025 18:58:51 +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 1u6wLy-007pPz-OO for pgsql-hackers@lists.postgresql.org; Mon, 21 Apr 2025 18:58:51 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u6wLu-001H6z-3B for pgsql-hackers@lists.postgresql.org; Mon, 21 Apr 2025 18:58:50 +0000 Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-6e8ffa00555so37820266d6.0 for ; Mon, 21 Apr 2025 11:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1745261926; x=1745866726; 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=w/FyZXv1tSOxIEVBGNJp64npz2OBul0sKJoBMHesXgk=; b=bc26pE/xn5ZgaECY4Y2gQ9DYbsucHIye5spxjvpZwWkc7fIoaHTluLu3aT4KO9dxd2 WcxtTBg3UuFwU7rGpRPjQw9CwchE37bZM4U29/Aah8CTq5YD4VJiyRYp6IjI0jUqvu54 QYRlyl7vTG0VOwjFQElvNc3v4fn7Ncth7QrhRQywcuSq9bS5pJ4ivw8i9rGVRZLu8P1u uaz5w0OBGAjPL88PXt9esAePalR61Hfpy7CnQGTSefuS3IYGEo13fSO3mthQftJar6rh LFNFf/GsfjZZCVNlYn+K8neruXQqOXZHhmFZIbnWyRPn5V+T7KByyIllUyd/pn0pOAhN 1G/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745261926; x=1745866726; 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=w/FyZXv1tSOxIEVBGNJp64npz2OBul0sKJoBMHesXgk=; b=eNFCsJHYpsgtjJ2zFbR6Elc8SqVPxXID+9HxG5AgNNwpBhFbD6F00LWOCoDK5jvQSK BUfSm0qeADTMiPLGmVrZ2zwmys0Os9UEnl0yYZPS6zIjdkLPKwhuFGY7sINXSK4hYRtH zbMQDgf89+5iiCurwm2+KDFleFKahKHCjRrqtpyQP37PD/VMzGj8Bo3vvDQtM+PfNyDw 4kN7o0JaMt0HVSfrRe27bgrUzPKAYQEf0rDnPbLIgCrtvbD6jbFdNbprJkncZ+e50HcJ f4KNKYak8XA1qvlLjyNxzJTHa+UO2CxpM6Zw2PUmjT6R8fbt7ro2e8HbXCfZt4u97toz nq0w== X-Forwarded-Encrypted: i=1; AJvYcCVxPNNSoCZbRJBP2AVkX+FlE10gPC7uBKSwJ3WYgJUdhpvKMpXbMX4TJLyvoku7f1VP9HtlC41w7QL9IGBW@lists.postgresql.org X-Gm-Message-State: AOJu0Yx6EF6qH1C0UxUljF/Aptyu5QL2fNXbrtYhV1w8F1VAfspCytX8 oLneocgffTaIOEoHtU9PnwVul+LTodkm/X1ZU7zR21GnQXRjMdMMsV0MayDLURlD0Opjpzqd7Xo ZKgV8zKsn8PvY5VtYPCB39104bt3tl/TNKgXo X-Gm-Gg: ASbGnctCO8XiGX+uwe6nBZvR2kmtMi6WHD6eexXD6Z/sQ7VThJpql8zpOXExYe+oGU5 /LjoJqPfUE2dLSaKeMCRIQwsue2TySRY8889yflVMOYsd8dq1tlmh376kVyekxTkgCBXRhUoGC3 qcPgbwoDQY6DHt2QEZ+6zS X-Google-Smtp-Source: AGHT+IEKfylSt4qh/Cto7NrwOU3zAERHa6OtDZdqROd8aWM2XiMILiC6vgn9D8FgrP7so62mXAoGjgEBGhZiIAAuPYc= X-Received: by 2002:a05:6214:23c6:b0:6ea:d393:962f with SMTP id 6a1803df08f44-6f2c453aa96mr212407156d6.16.1745261925919; Mon, 21 Apr 2025 11:58:45 -0700 (PDT) MIME-Version: 1.0 References: <2074634.1744839761@sss.pgh.pa.us> <0A3CF5C4-9947-42E3-89A9-34FCF7BA95BA@yesql.se> <2078511.1744841564@sss.pgh.pa.us> <2084687.1744844690@sss.pgh.pa.us> <2087556.1744846124@sss.pgh.pa.us> <0A596D8B-24F3-408F-B89B-B42014B00A05@yesql.se> <2202326.1744903233@sss.pgh.pa.us> <25801148-284F-41F9-A279-A4CF92623C77@yesql.se> <102E1997-FB99-4091-926C-9A8BB3EA168E@yesql.se> In-Reply-To: <102E1997-FB99-4091-926C-9A8BB3EA168E@yesql.se> From: Jacob Champion Date: Mon, 21 Apr 2025 11:58:34 -0700 X-Gm-Features: ATxdqUGLUyG1ohg-2miY4C-YCqfJ6VmifIO5VgHKlSFU2pM3-sgBJKCJZy3Qk9M Message-ID: Subject: Re: jsonapi: scary new warnings with LTO enabled To: Daniel Gustafsson Cc: Tom Lane , PostgreSQL Developers 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 Mon, Apr 21, 2025 at 11:46=E2=80=AFAM Daniel Gustafsson wrote: > We do, but with the current coding we call setJsonLexContextOwnsTokens > immediately after creation which derefences the pointer without checkinf = for > allocation failure. Right. (The flag does nothing on the OOM sentinel.) > This means we dereference the pointer before we can check > for an OOM return from pg_parse_json which even if safe seems to violate = code > readability no? Personally, I'm fine with can't-fail APIs, as long as they're documented as such. (I think the deferred error API was probably chosen so that src/common JSON clients could be written without a lot of pain?) --Jacob