From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 889B1A0546; Thu, 27 May 2021 23:24:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8473A40150; Thu, 27 May 2021 23:24:31 +0200 (CEST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mails.dpdk.org (Postfix) with ESMTP id B05A240143 for ; Thu, 27 May 2021 23:24:29 +0200 (CEST) Received: by mail-lf1-f44.google.com with SMTP id e17so2214078lfb.2 for ; Thu, 27 May 2021 14:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=paHGsjPxhI0Yiz/WD9KGaphNVrAjrE3UwsgGwfWXcLI=; b=r4QcDzCvY+yDQMxg32AML4zBUsiTZ9XuyNdcWJnuKjyz8LRDpx3PPrZoxE1Mx/ft/l lKN5VKUleRklfRFGkyVTEPDGiVCUb8B4Bm4Dh1JUqrKBXHsIF+XrFHrqo4uAs/Sw1zQ9 0JQrSJL19QNOXxqTKcbIbD8ZdV/6jxiuRh5tx5NuWzusLOh+2/UfajkldxNElEseGycU gHQvDtO1wL12LBYZfLupeRdJm8HZR91zNF8BKiYiAMt6cFYaLgiMqqvMW/tpbGWXBwKS lI0+Hbzp/h/9IQiJrOqijblqsEEx+Pc+1h46S54X7Fs27PTUfzN7NUsyPHqPXke5nYnk wYRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=paHGsjPxhI0Yiz/WD9KGaphNVrAjrE3UwsgGwfWXcLI=; b=Thx5DlHFq8Cs0qmMYbeXwPB1wpoVO/dN1MPqZV+UGwoR1O8jkODR5IOaQ/njEdLgwj SXBrGIAC1WkCyUFLyy4okow7OjL6fkDFIdn3qtJ6GjhIgtxxvxzeDwcAWq7/OsXTv/Xb G73JZtWMMXrdNDts/33d2xKbzSvAMvDVz5gBUJXUBJHoodZ9l78XtTSn90Vx6vvvFDHK XY8ok7YHBUwlm1C/P16JMTgEAZz+gIpyXyIicp7eU+WOVnsETmtvMI6yceNGvdOx0s/F 3U+Az0DL19UcFqHwoYIWpOcQurMxjRGGxoorccr3PB/og90Kv2VoxBnlCvn9kfZTbfoA 7jKg== X-Gm-Message-State: AOAM532rW467KjWFi4XppR1G5W++4E7W08PkOB4Uw5KpOBnyoSKSz6F+ wJ6bTKyx7iYwBjgPHJasD5xvGjfH2sSGXw== X-Google-Smtp-Source: ABdhPJxapVPH0ffxPGv8r+l/6Fx6COCRQTfHPujhTbHTnMPlCWyWNcxXi3ykJh4z3t7qcZGWRCtq0A== X-Received: by 2002:a05:6512:6c7:: with SMTP id u7mr3590639lff.27.1622150668918; Thu, 27 May 2021 14:24:28 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id c9sm387727lji.18.2021.05.27.14.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 14:24:28 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Zhihong Peng , Dmitry Kozlyuk , Neil Horman Date: Fri, 28 May 2021 00:24:21 +0300 Message-Id: <20210527212421.24224-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210526214343.31352-1-dmitry.kozliuk@gmail.com> References: <20210526214343.31352-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] pmdinfogen: allow padding after NUL terminator X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Size of string constant symbol may be larger than its length measured up to NUL terminator. In this case pmdinfogen included padding bytes after NUL terminator in generated source, yielding incorrect code. Always trim string data to NUL terminator while reading ELF. It was already done for COFF because there's no symbol size. Bugzilla ID: 720 Fixes: f0f93a7adfee ("buildtools: use Python pmdinfogen") Signed-off-by: Dmitry Kozlyuk --- v2: return helper to coff.py, where it's needed (David Marchand). buildtools/pmdinfogen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py index 7a739ec7d4..2a44f17bda 100755 --- a/buildtools/pmdinfogen.py +++ b/buildtools/pmdinfogen.py @@ -28,7 +28,7 @@ def __init__(self, image, symbol): def string_value(self): size = self._symbol["st_size"] value = self.get_value(0, size) - return value[:-1].decode() if value else "" + return coff.decode_asciiz(value) # not COFF-specific def get_value(self, offset, size): section = self._symbol["st_shndx"] -- 2.29.3