From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8EF161FF140 for ; Fri, 27 Mar 2026 16:06:11 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0B08011150; Fri, 27 Mar 2026 16:06:35 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [RFC perlmod] ffi glue: type detection: check actual SV flags instead of structural body type From: Wolfgang Bumiller To: Thomas Lamprecht In-Reply-To: <20260310204737.2475584-1-t.lamprecht@proxmox.com> References: <20260310204737.2475584-1-t.lamprecht@proxmox.com> Date: Fri, 27 Mar 2026 16:06:29 +0100 Message-Id: <177462398929.480952.2396055683726895580.b4-review@b4> X-Mailer: b4 0.15.1 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774623940716 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.085 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: SAR2F6S4MQVRHZNSJ7BUOTNVXF3N5AKE X-Message-ID-Hash: SAR2F6S4MQVRHZNSJ7BUOTNVXF3N5AKE X-MailFrom: w.bumiller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 10 Mar 2026 21:45:43 +0100, Thomas Lamprecht wrote: > RSPL_type_flags and the RSPL_has_* helpers used a lookup table indexed > by SvTYPE, which reflects the structural body layout (what slots are > allocated) rather than which slots hold valid data. Since SV body types > only upgrade and never downgrade, this caused misclassification [0]. > > For example, a string "65004" coerced to integer via int() still > reported STRING|INTEGER|DOUBLE because SvTYPE remained SVt_PVNV. The > deserializer then treated it as a string, and the SvPVutf8 call to > read it set SVf_POK as a side effect, making the contamination > permanent. > > Replace the table with actual per-slot validity checks using > SvIOKp/SvNOKp/SvPOKp. The private "p" variants are needed because > SvOK (used in RSPL_is_defined) also considers private flags -- using > only the public variants can leave defined values with no type flags. Doing my $x = 3; shows via Devel::Peek's Dump($x): FLAGS = (IOK,pIOK) and after doing "stringify${x}" or $x ~= /./ it shows FLAGS = (IOK,pIOK,pPOK) indicating that *privately* it also has a string representation. So IMO we could check public flags first, but then fall back to the old code if they are empty for some reason? --