代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/exiv2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From e40c9c148e4d2135d0d732b8dff994a9afde3394 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dan.cermak@cgc-instruments.com>
Date: Fri, 6 Jul 2018 11:51:55 +0200
Subject: [PATCH] Remove buffer overread in tExtToDataBuf
The pointer p is advanced in the while loop to step over three '\n'.
However, its length is never reduced accordingly. => the length check in the
following for loop is invalid, as it permits overreading by the number of
characters that p was advanced by.
---
src/pngimage.cpp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index dc623c4..a99a20b 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -160,12 +160,21 @@ namespace Exiv2 {
}
// calculate length and allocate result;
+ // count: number of \n in the header
long count=0;
+ // p points to the current position in the array bytes
const byte* p = bytes ;
- // header is \nsomething\n number\n hex
- while ( count < 3 )
- if ( *p++ == '\n' )
+
+ // header is '\nsomething\n number\n hex'
+ // => increment p until it points to the byte after the last \n
+ // p must stay within bounds of the bytes array!
+ while ((count < 3) && (p - bytes < length)) {
+ // length is later used for range checks of p => decrement it for each increment of p
+ --length;
+ if ( *p++ == '\n' ) {
count++;
+ }
+ }
for ( long i = 0 ; i < length ; i++ )
if ( value[p[i]] )
++count;
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。