{"id":2221002,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221002/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260408140339.798015-2-aristo.chen@canonical.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260408140339.798015-2-aristo.chen@canonical.com>","list_archive_url":null,"date":"2026-04-08T14:03:36","name":"[v1,2/2] test: env: add test for himport_r SIZE_MAX overflow guard","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"198d2176c4fd0e1c8207039447ebcd2e44ed3ea1","submitter":{"id":92721,"url":"http://patchwork.ozlabs.org/api/1.2/people/92721/?format=json","name":"Aristo Chen","email":"aristo.chen@canonical.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.2/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260408140339.798015-2-aristo.chen@canonical.com/mbox/","series":[{"id":499162,"url":"http://patchwork.ozlabs.org/api/1.2/series/499162/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=499162","date":"2026-04-08T14:03:35","name":"[v1,1/2] lib: hashtable: fix integer overflow in himport_r","version":1,"mbox":"http://patchwork.ozlabs.org/series/499162/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221002/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221002/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (4096-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20251003 header.b=TRW4bVHh;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=canonical.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (4096-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.b=\"TRW4bVHh\";\n\tdkim-atps=neutral","phobos.denx.de; dmarc=pass (p=reject dis=none)\n header.from=canonical.com","phobos.denx.de;\n spf=pass smtp.mailfrom=aristo.chen@canonical.com"],"Received":["from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frTn2304Hz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 02:59:18 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 0309784106;\n\tWed,  8 Apr 2026 18:59:09 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 3E3C584106; Wed,  8 Apr 2026 16:04:38 +0200 (CEST)","from smtp-relay-internal-0.canonical.com\n (smtp-relay-internal-0.canonical.com [185.125.188.122])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 618BE8407E\n for <u-boot@lists.denx.de>; Wed,  8 Apr 2026 16:04:36 +0200 (CEST)","from mail-pl1-f200.google.com (mail-pl1-f200.google.com\n [209.85.214.200])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 1D02A3F648\n for <u-boot@lists.denx.de>; Wed,  8 Apr 2026 14:04:36 +0000 (UTC)","by mail-pl1-f200.google.com with SMTP id\n d9443c01a7336-2b24305cb3cso72957735ad.2\n for <u-boot@lists.denx.de>; Wed, 08 Apr 2026 07:04:36 -0700 (PDT)","from noble-uboot.lxd (124-218-37-86.cm.dynamic.apol.com.tw.\n [124.218.37.86]) by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b2749a3af9sm194312545ad.63.2026.04.08.07.04.28\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Apr 2026 07:04:29 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,\n RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20251003; t=1775657076;\n bh=JundCE4mMIYy9PnhaHJQKnMSwD1qy+qfUkMn8hUqmuI=;\n h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n MIME-Version;\n b=TRW4bVHh449i522p76o1M6mTRgEtbaTVo1E+2ozyDnCoiMApsDUTSkr36VVx5sspv\n VpLTfQtCa1OlsyqsvsLxa6iignbrn362kTK2SajHoiDlSIE+4tEhaZAfQKVYwDl938\n YWDLueiHK5H0E0l2nEvueTjytucF8HwDO0FqFGd8HCc8H9qcOzgGZET/Lpe65Wa49K\n MbIq/0Uy0OnntDWcblCb6vncrkptBvLlVNjrUDhFPy+r5hZvbELARODFn4P6T1JNEj\n /VIsRx4Pt5PP6In0NyHMmYZF6ow5v8MWzqljG0VkiGcZMwkZZMFx+lDRK1trXBQOLt\n O2maQlp0sfkmSUAJBg2WtGZNYnwcrC/ePa5bv3H63vLckdT0q9+5OhwERtNc45BVfs\n B1eaAHkPOrxsVtNh61hJcOYOGVf7QEV/BVzgWP17e02/LOxVBpKdt5IrYrbsigxG1l\n KSN8P+1SZAQnrIyLJL/MWLEgEWoxx79dbaqnhOVhg8P23ugqSuamNgQuI7OxKWblHm\n 6MtmnHCHJkNFf+FHKQFA9xnIIvA5jGwA+HUcHP9LceJTrN8xxh2ahnX/QbwNEdrK6t\n zjYubDOl3Mi8hKXc3O0OqWukJfzfHFnNDF3D1RHF+8GWiv04BTcjcL4iYdaj+BSSGZ\n H3D/lgOExCHneTGmzYIkP+ak=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775657074; x=1776261874;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=JundCE4mMIYy9PnhaHJQKnMSwD1qy+qfUkMn8hUqmuI=;\n b=Sb9fKWK6mz35M8dkRJQMyw6Wzr2OGopY7wRXJBT+AyO3INeSTSHrcH/h85GPROsnsE\n aecjZ82XTnzgLgmla0tjnViTd4dhJcli/DM0hhZXuB7nGTkCP2jLXEr3kBJbtp4Ld8Vo\n aAJgB+03i97zHZhlEMKCcJsNTSLJ2wYyxP7T/NhsIHSYQrqUgnUzAKhGE7+nCvAyb+26\n kYqC31ZRxkOBo7shhcTASl1dZ2GNf9u/qROY7MvgaiYrCjlwBgBP9KdWgYKS0dE0EkxP\n EctJTIvBw/rnjJdUB1UpqKbjtfJJEBF0SA+GLAZ10gaAJ5m3KXD2SXdz3Q+gCwjNZ9KL\n yfgQ==","X-Gm-Message-State":"AOJu0Yxcy6ezfHZUDko8JBUbm4OK25Xm6gumRUh0UQS+Kt42GcRQH/7P\n s53YYSYaelbJk1eWeZ41+Cvm5d30F27NuBfHMGWap2UWilPk2nBKEaqhOwp+29tQqdAZcSbIXYr\n 3gJnDEUWbP2h4YNRIsfTrb98WDsFm4yz8gKT/rlm7D9wf9pTY37MYUtqcgp/Kh8iDMxCAUFDJdJ\n bl0Agl2A==","X-Gm-Gg":"AeBDievhV9gR0RTMqwLb3FeGfBjUmX9ULdmEM2+M4ZSAs/YM8ZnXA3PSv31en43TD4O\n aK1ULmvnIaNesLCAkDUsu05jnMXxSrlH40lQQ72nmijK5w30gTgjBXPIP2Jtyg4j+EvCJHP+N8W\n YyKaFtBRHuGTDtKSJuPM8agcPsa3OzdAjtFS1SetK0TEDZqT6p1kifEokfWpTll5D8cLd6yNNTD\n kyBOcn4qwD4U+Og4OTlA/nqI+0DuVP98+ZYmoQTH7m07/huyjXYprsqKB7YPDHuBkWNmyYjs+0M\n TmJhyl8xmoiA/G/Sfcnto57njDA+0AcqPGrReeDwKdIqCdYd5fni2XgcU9OCZcp/NFr/gMXDC7O\n AQNzwYGByBJVOjX6nVJM5Qg7lCkyJ39WcMT09lALO1jc9GkAhg81q8V1oYEcIzOLRW6nNyxen","X-Received":["by 2002:a17:903:240a:b0:2b0:4b3a:9b4d with SMTP id\n d9443c01a7336-2b2816e965dmr203819365ad.20.1775657073417;\n Wed, 08 Apr 2026 07:04:33 -0700 (PDT)","by 2002:a17:903:240a:b0:2b0:4b3a:9b4d with SMTP id\n d9443c01a7336-2b2816e965dmr203817535ad.20.1775657070958;\n Wed, 08 Apr 2026 07:04:30 -0700 (PDT)"],"From":"Aristo Chen <aristo.chen@canonical.com>","To":"u-boot@lists.denx.de","Cc":"Aristo Chen <aristo.chen@canonical.com>,\n\tTom Rini <trini@konsulko.com>","Subject":"[PATCH v1 2/2] test: env: add test for himport_r SIZE_MAX overflow\n guard","Date":"Wed,  8 Apr 2026 14:03:36 +0000","Message-ID":"<20260408140339.798015-2-aristo.chen@canonical.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260408140339.798015-1-aristo.chen@canonical.com>","References":"<20260408140339.798015-1-aristo.chen@canonical.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Mailman-Approved-At":"Wed, 08 Apr 2026 18:59:06 +0200","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Add a unit test that verifies himport_r rejects SIZE_MAX as the size\nargument, ensuring the integer overflow guard added to lib/hashtable.c\nis exercised and not accidentally regressed.\n\nSigned-off-by: Aristo Chen <aristo.chen@canonical.com>\n---\n test/env/hashtable.c | 17 +++++++++++++++++\n 1 file changed, 17 insertions(+)","diff":"diff --git a/test/env/hashtable.c b/test/env/hashtable.c\nindex 16e49358888..ce9689f46d7 100644\n--- a/test/env/hashtable.c\n+++ b/test/env/hashtable.c\n@@ -122,3 +122,20 @@ static int env_test_htab_deletes(struct unit_test_state *uts)\n \treturn 0;\n }\n ENV_TEST(env_test_htab_deletes, 0);\n+\n+/* Verify himport_r rejects SIZE_MAX to prevent integer overflow in malloc */\n+static int env_test_htab_import_overflow(struct unit_test_state *uts)\n+{\n+\tstruct hsearch_data htab;\n+\n+\tmemset(&htab, 0, sizeof(htab));\n+\tut_asserteq(1, hcreate_r(SIZE, &htab));\n+\n+\t/* SIZE_MAX would cause malloc(size + 1) to wrap to malloc(0) */\n+\tut_asserteq(0, himport_r(&htab, \"\", SIZE_MAX, '\\0', 0, 0, 0, NULL));\n+\n+\thdestroy_r(&htab);\n+\treturn 0;\n+}\n+\n+ENV_TEST(env_test_htab_import_overflow, 0);\n","prefixes":["v1","2/2"]}