{"id":10284,"url":"https://patchwork.libcamera.org/api/1.1/patches/10284/?format=json","web_url":"https://patchwork.libcamera.org/patch/10284/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201028085726.2983867-1-hiroh@chromium.org>","date":"2020-10-28T08:57:26","name":"[libcamera-devel] android: camera_device: Fix crash of accessing a missing map element","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"f9de6f73d2ddfdaedb01ee9a8d402ecefb4333f9","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10284/mbox/","series":[{"id":1425,"url":"https://patchwork.libcamera.org/api/1.1/series/1425/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1425","date":"2020-10-28T08:57:26","name":"[libcamera-devel] android: camera_device: Fix crash of accessing a missing map element","version":1,"mbox":"https://patchwork.libcamera.org/series/1425/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10284/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10284/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 C536FC3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Oct 2020 08:57:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 46A08622F0;\n\tWed, 28 Oct 2020 09:57:37 +0100 (CET)","from mail-pl1-x643.google.com (mail-pl1-x643.google.com\n\t[IPv6:2607:f8b0:4864:20::643])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81A3962067\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Oct 2020 09:57:35 +0100 (CET)","by mail-pl1-x643.google.com with SMTP id w11so2151475pll.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Oct 2020 01:57:35 -0700 (PDT)","from hiroh.tok.corp.google.com\n\t([2401:fa00:8f:2:de4a:3eff:fe7d:f78f])\n\tby smtp.gmail.com with ESMTPSA id\n\ti1sm5074667pfa.168.2020.10.28.01.57.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 28 Oct 2020 01:57:32 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BTbOIN7x\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=WLBKaFc2xmK8hx09lZ7yw//Cc2rOlGDiuXjLjlSLM1U=;\n\tb=BTbOIN7xMH2wK3RSWLoHUvQjEDIyU75nMv3rGP92laeH26xAlMa9wnYIJ3TVp1w0jO\n\tf7rbqauR+wt2RKGYG/dGfkNfkCIuGfG4j71/u6jskfuwncIiPt8mvcufJf0o/6wz9aYp\n\tEjyAV/fftIfWbYpwJN9V8ys+v4baj4AbLoKdY=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=WLBKaFc2xmK8hx09lZ7yw//Cc2rOlGDiuXjLjlSLM1U=;\n\tb=KKRjr4b7rCQQdf8esAEMicqxq8+FHkrU3vx6SpN7rhXY+tdp2Kyks1zp1LjPbMSq7A\n\thqzIa6fR+SORFWMoWzZfQwTs4kYdI1kHk4NiVZ38q2BtIYO6zvr8928f9RUw8bY+o5H8\n\tbAAcecKzSNniyWjxqMaJ1TBV97OmVB9Sjfyl1xduLZSBftBURH8ibOUFbgsEXM6O+liL\n\t1tkoWffQrnclilloA4anpA2Dx9w+V2GS1pyVBR2T2HBcNG78ObnqJUUpnXZJEHUvR/lb\n\tndht0Mm92jKF+eSLSsYp3PMflM3QJ71Gw9ytyw+9qDsWhJhAdNuzpwf9GbaxEXpwzdK3\n\tQjiw==","X-Gm-Message-State":"AOAM533dStJtGVUqknifUSePLiN1L9EOsk1tWRaZv8tdKf5D6gx+bOrF\n\tgWZQN71y429DwzOvfuDIETjeAjWXNlM10Q==","X-Google-Smtp-Source":"ABdhPJw6PzEHGemfMTVJJMivbkX7CivKcAXwUXEpNrhUdmjikI9XDFq9R5ekfEuvrvMZ/rFAOgctww==","X-Received":"by 2002:a17:90b:3882:: with SMTP id\n\tmu2mr5810846pjb.112.1603875453288; \n\tWed, 28 Oct 2020 01:57:33 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 28 Oct 2020 17:57:26 +0900","Message-Id":"<20201028085726.2983867-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.29.0.rc2.309.g374f81d7ae-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] android: camera_device: Fix crash of\n\taccessing a missing map element","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":"std::map::at() searches std::map by the given key. The commit\ne1f9fdb8a5bd096faa34d54804afa48d46d59b28 uses it with 0 to intend to\naccessing the first element of the map, but actually access the\nelement whose key is nullptr. This causes the crash because the map\ndoesn't have the element with nullptr. This fixes the issue by\nreplacing the std::map::at() operation by std::map::begin().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n--\n2.29.0.rc2.309.g374f81d7ae-goog","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex ca60f51..ead8a43 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1525,7 +1525,7 @@ void CameraDevice::requestComplete(Request *request)\n \t * It might be appropriate to return a 'correct' (as determined by\n \t * pipeline handlers) timestamp in the Request itself.\n \t */\n-\tuint64_t timestamp = buffers.at(0)->metadata().timestamp;\n+\tuint64_t timestamp = buffers.begin()->second->metadata().timestamp;\n \tresultMetadata = getResultMetadata(descriptor->frameNumber_, timestamp);\n\n \t/* Handle any JPEG compression. */\n","prefixes":["libcamera-devel"]}