Patch Detail
Show a patch.
GET /api/patches/9964/?format=api
{ "id": 9964, "url": "https://patchwork.libcamera.org/api/patches/9964/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9964/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20201005165701.77469-1-email@uajain.com>", "date": "2020-10-05T16:57:01", "name": "[libcamera-devel,v2] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "f07ee07b79c064ca36edf65d3377bfaa25fb2e5d", "submitter": { "id": 1, "url": "https://patchwork.libcamera.org/api/people/1/?format=api", "name": "Umang Jain", "email": "email@uajain.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/9964/mbox/", "series": [ { "id": 1351, "url": "https://patchwork.libcamera.org/api/series/1351/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1351", "date": "2020-10-05T16:57:01", "name": "[libcamera-devel,v2] android: jpeg: exif: Sanitize ASCII strings with utils::toAscii()", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1351/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/9964/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9964/checks/", "tags": {}, "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 80C58C3B5D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 5 Oct 2020 16:57:09 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 09BA463BFE;\n\tMon, 5 Oct 2020 18:57:09 +0200 (CEST)", "from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C9E0F63BED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 5 Oct 2020 18:57:07 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"qbcIASXk\"; dkim-atps=neutral", "From": "Umang Jain <email@uajain.com>", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1601917027; bh=sEUbrg58M7L71EHmbbAPqTtFcaJlToAkzriHSB858Nk=;\n\th=From:To:Cc:Subject;\n\tb=qbcIASXkOm28FLEtstx7gPO3i7IUtfM2JJPGTF3CxJCNfC1B1qgDLdnySyZsEQ8wE\n\t8ozb8d0nAVEuti/35cySp24NFdbjyyndvjzJ53OPaVDs2nr0oGHYCWyZAjNUD8hLjM\n\tCeizQ7jcNYxyKB7LeUYn/SeBHAeR+6yr3ctYBqOVxOp26aMq7pO7ew8yXqbfEymdmF\n\tIzqu4tINs7sUezUCyTPA2/MWugANgMPNsMnEsdcIv4D+7hBuMPLOpEw5t5lJsb+DHB\n\tGR+WGqDhrb0UYeGOJHMp/a402h1XAPiU1I1BFDbOxIuUeMDEREvCbCpmpqZbTvEAVF\n\t/KPg84SkmBCVg==", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 5 Oct 2020 22:27:01 +0530", "Message-Id": "<20201005165701.77469-1-email@uajain.com>", "Mime-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2] android: jpeg: exif: Sanitize ASCII\n\tstrings with utils::toAscii()", "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>", "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>" }, "content": "Use the newly introduced utils::toAscii() utility to remove all\nnon-ASCII characters for EXIF_FORMAT_ASCII strings.\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n src/android/jpeg/exif.cpp | 16 ++++++++++++----\n 1 file changed, 12 insertions(+), 4 deletions(-)\n\n---\n\nChanges in v2:\n - Set new length for sanitized string.", "diff": "diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp\nindex 3fd5d55..56e3c6a 100644\n--- a/src/android/jpeg/exif.cpp\n+++ b/src/android/jpeg/exif.cpp\n@@ -8,6 +8,7 @@\n #include \"exif.h\"\n \n #include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/utils.h\"\n \n using namespace libcamera;\n \n@@ -171,15 +172,22 @@ 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 in ASCII format. */\n-\tsize_t length = format == EXIF_FORMAT_ASCII ?\n-\t\t\titem.length() + 1 : item.length();\n+\tsize_t length = item.length();\n+\tstd::string str = item;\n+\tif (format == EXIF_FORMAT_ASCII) {\n+\t\tstr = utils::toAscii(str);\n+\t\t/*\n+\t\t * Get new length and pad 1 extra byte to null-terminate\n+\t\t * the ASCII string.\n+\t\t */\n+\t\tlength = str.length() + 1;\n+\t}\n \n \tExifEntry *entry = createEntry(ifd, tag, format, length, length);\n \tif (!entry)\n \t\treturn;\n \n-\tmemcpy(entry->data, item.c_str(), length);\n+\tmemcpy(entry->data, str.c_str(), length);\n \texif_entry_unref(entry);\n }\n \n", "prefixes": [ "libcamera-devel", "v2" ] }