1 Star 0 Fork 39

ethan848/sqlite

forked from src-openEuler/sqlite 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
6008-Fix-a-potential-crash-that-can-occur-while-reading-a.patch 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:17 . Package init
From 2b256aaaae3c32e69a5a4c24d7bb22bbc7232f88 Mon Sep 17 00:00:00 2001
From: "D. Richard Hipp" <drh@hwaci.com>
Date: Mon, 1 Oct 2018 13:54:30 +0000
Subject: [PATCH 0435/1009] Fix a potential crash that can occur while reading
an index from a corrupt database file. The corruption is a
record-header-size that is larger than 0x7fffffff. Problem detected by
OSSFuzz against GDAL and reported to us (with a suggested fix) by Even
Rouault. The test case is in TH3.
https://github.com/mackyle/sqlite/commit/2b256aaaae3c32e69a5a4c24d7bb22bbc7232f88
---
src/vdbeaux.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 5ec3d13..99df435 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -4557,7 +4557,9 @@ int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){
(void)getVarint32((u8*)m.z, szHdr);
testcase( szHdr==3 );
testcase( szHdr==m.n );
- if( unlikely(szHdr<3 || (int)szHdr>m.n) ){
+ testcase( szHdr>0x7fffffff );
+ assert( m.n>=0 );
+ if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){
goto idx_rowid_corruption;
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ethan848/sqlite.git
git@gitee.com:ethan848/sqlite.git
ethan848
sqlite
sqlite
master

搜索帮助