[{"id":12856,"web_url":"https://patchwork.libcamera.org/comment/12856/","msgid":"<20200929025047.GT14614@pendragon.ideasonboard.com>","date":"2020-09-29T02:50:47","subject":"Re: [libcamera-devel] [PATCH v2 1/2] android: jpeg: exif: Pad extra\n\tbyte only for ASCII format in setString()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Fri, Sep 25, 2020 at 12:06:41AM +0530, Umang Jain wrote:\n> The EXIF standard states that EXIF_FORMAT_UNDEFINED shall not be\n> terminated with NULL. The patch implements this particular detail and\n> pad one extra byte for EXIF_FORMAT_ASCII to null-terminate strings.\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/android/jpeg/exif.cpp | 5 +++--\n>  1 file changed, 3 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\n> index c0dbfcc..a5674b3 100644\n> --- a/src/android/jpeg/exif.cpp\n> +++ b/src/android/jpeg/exif.cpp\n> @@ -157,8 +157,9 @@ void Exif::setRational(ExifIfd ifd, ExifTag tag, ExifRational item)\n>  \n>  void Exif::setString(ExifIfd ifd, ExifTag tag, ExifFormat format, const std::string &item)\n>  {\n> -\t/* Pad 1 extra byte for null-terminated string. */\n> -\tsize_t length = item.length() + 1;\n> +\t/* Pad 1 extra byte for null-terminated string in ASCII format. */\n> +\tsize_t length = format == EXIF_FORMAT_ASCII ?\n> +\t\t\titem.length() + 1 : item.length();\n>  \n>  \tExifEntry *entry = createEntry(ifd, tag, format, length, length);\n>  \tif (!entry)","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 58E2AC3B5B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Sep 2020 02:51:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D13BD62033;\n\tTue, 29 Sep 2020 04:51:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CAD8160394\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Sep 2020 04:51:22 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 40BDE540;\n\tTue, 29 Sep 2020 04:51:22 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"jl5isfH5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601347882;\n\tbh=pF+4bsdoTt5hzJVQSlioYqxQqizyd1QowAeLYtYR/xw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=jl5isfH53OlEJeNXHcEWCtXLMLdadCn8uwZ19H/wMngmWWtIwZKD0Mea4IuP0p6Kr\n\ti9JMcAErPoZ0OJdQe5J3g9H6hHJ8c5xRewKxLjT5yeDvHJOtSUUZGRA7PO/3MqTq2Q\n\ttrekoe1/J/ksFKs8b91IsHJR18YIPRKFR4YvGAus=","Date":"Tue, 29 Sep 2020 05:50:47 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Message-ID":"<20200929025047.GT14614@pendragon.ideasonboard.com>","References":"<20200924183642.7674-1-email@uajain.com>\n\t<20200924183642.7674-2-email@uajain.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200924183642.7674-2-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/2] android: jpeg: exif: Pad extra\n\tbyte only for ASCII format in setString()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]