已开启
fix CVE-2026-39113 #286
已开启
hanjinpeng创建于 12 天前
hanjinpeng
12 天前

当前PR是否有AI参与

[ ] 否

[x] Yes
__1. AI Agent平台: DeepSeek Harness
__2. AI模型: GLM-5.2
__3. Prompt上下文: 基于上游 commit 169f68ed88b34cb68f720191c64c058f2ccec508 生成 backport patch,完成 spec 修改与 changelog 更新

参考:openEuler社区《生成式AI工具使用与开源贡献政策》

PR功能描述 / 为什么需要这个合入

fix CVE-2026-39113: ext/misc/sqlar.c sqlarUncompressFunc() 缓冲区溢出

CVE-2026-39113 中,sqlarUncompressFunc() 使用 sqlite3_value_int() 读取解压后大小 sz,32 位截断后传入 sqlite3_malloc(int) 分配过小缓冲区,uncompress() 实际写入完整解压数据导致堆缓冲区溢出,攻击者可造成拒绝服务。修复方式为改用 sqlite3_value_int64() 读取完整 64 位大小。

上游来源:https://github.com/sqlite/sqlite/commit/169f68ed88b34cb68f720191c64c058f2ccec508

修复类型:Bug修复 / 安全修复

回合说明:基于 sqlite 3.42.0 版本回合上游补丁。ABI:无 ABI 变化(仅 ext/misc/sqlar.c 内部单行修改,不涉及任何导出符号)

CVE 修复补丁实现说明:

漏洞代码(ext/misc/sqlar.c,sqlarUncompressFunc()):

uLong nData;
uLongf sz;

assert( argc==2 );
sz = sqlite3_value_int(argv[1]);        /* 修复前:32 位截断 */

if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){
  sqlite3_result_value(context, argv[0]);
}else{
  const Bytef *pData = sqlite3_value_blob(argv[0]);
  Bytef *pOut = sqlite3_malloc(sz);     /* 按截断后的 sz 分配 */
  ...
  uncompress(pOut, &sz, pData, nData);  /* zlib 按真实解压大小写入 → 溢出 */

实现原理:

  1. 溢出成因:sqlar 归档中每个条目记录了解压后大小 sz(最大 64 位)。sqlite3_value_int() 返回 int(32 位),当条目声明 sz > 0xFFFFFFFF(如 0x100000001)时被截断为小值(如 1);sqlite3_malloc(sz) 按截断值分配堆缓冲区,而 zlib uncompress() 会将完整解压数据写入该缓冲区,造成堆越界写;
  2. 修复方式:将 sqlite3_value_int(argv[1]) 改为 sqlite3_value_int64(argv[1]),以 sqlite3_int64(64 位)完整读取 sz,使分配大小与实际解压大小一致。sz 过大时 sqlite3_malloc() 分配失败返回 NULL,走既有的 sqlite3_result_error_nomem() 错误路径,不再触发溢出;
  3. 上游对应:本补丁回合自上游 commit 169f68ed88b34cb68f720191c64c058f2ccec508 中 ext/misc/sqlar.c 的改动(上游同 commit 还包含 btree.c/json.c 的无关加固,见下方回合说明);
  4. 行为兼容性:sz 在 32 位范围内时新旧代码行为完全一致(int64 与 int 读出的值相同),不影响正常 .sqlar 归档的解压功能;sz<=0sz==nData 的快捷路径判断逻辑不变。

影响:

  • 受影响场景:仅在使用 sqlar 扩展(SQLite Archive,sqlar_uncompress() SQL 函数)且解压条目声明大小超出 32 位 int 表示范围时触发;常规数据库操作不受影响
  • 攻击向量:构造恶意 .sqlar 归档(或直接调用 sqlar_uncompress() 传入超大 sz 值),导致堆缓冲区溢出 → 拒绝服务(进程崩溃);CVSS 评分 N/A(公开披露信息未给出评分)
  • 修复影响面:ext/misc/sqlar.c 单行修改,仅改变 sz 的读取宽度(32→64 位),正常输入下行为完全一致;不影响任何导出符号/公共 ABI,无需重建依赖组件
  • 该 CVE 影响 3.32.3 / 3.37.2 / 3.42.0(本分支版本在受影响列表内);master(3.53.4)已包含上游修复,不受影响

该PR关联的issue

fixes #98

希望检视人员了解

代码由AI辅助编写,已人工逐行核对逻辑、校验功能正确性,确保与预期一致。

likedislike
合并受阻
Hhanjinpeng
12 天前 创建了 pull request,commit cbbe754f
Hhanjinpeng
12 天前 关联了issue:CVE-2026-39113
openeuler-ci-botopeneuler-ci-bot成员
12 天前 将ZhengZhenyu,dillon_chen,xicoding设为审查人
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:sig/DB
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

Welcome To openEuler Community

Hey @protkhn , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: DB ,
and any of the maintainers: @ZhengZhenyu, @dillon_chen, @xicoding ,
and any of the committers: @wbq_sky .

likedislike
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

当前仓库存在以下 保护分支

Protected Branch Version Release
master 3.53.4 1
openEuler-22.03-LTS-SP4 3.37.2 11
openEuler-26.09-DevStation 3.53.4 1
openEuler-26.09 3.53.3 2
openEuler-24.03-LTS-SP1 3.42.0 8
openEuler-24.03-LTS-SP3 3.42.0 8
openEuler-24.03-LTS-Next 3.42.0 8
openEuler-24.03-LTS-SP4 3.42.0 8
openEuler-20.03-LTS-SP4 3.32.3 10
openEuler1.0-base 3.24.0 8
openEuler1.0 3.24.0 8

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:openeuler-cla/yes
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/src-openeuler/trigger/sqlite/157/console

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

x86_64架构构建及构建后检查:multiarch/src-openeuler/x86-64/sqlite/157/console

likedislike
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

aarch64架构构建及构建后检查:multiarch/src-openeuler/aarch64/sqlite/157/console

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 删除了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:
Check Name Build Result 详情 Build Details
check_binary_file SUCCESS #157
check_lfsconfig :ballot_box_with_check:EXCLUDE
check_package_yaml_file SUCCESS
check_repo_in_maintain SUCCESS
check_consistency SUCCESS
check_spec_file SUCCESS
x86_64 check_build SUCCESS #157
check_install SUCCESS
check_license SUCCESS
aarch64 check_build SUCCESS #157
check_install SUCCESS
check_license SUCCESS
likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ci_successful
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

如下为接口变更检查结果,目标分支为openEuler-24.03-LTS-Next,请PR提交者check差异信息

Arch Name Check Items Rpm Name Check Result Build Details
compare_package(x86_64) add_rpms SUCCESS #157
delete_rpms SUCCESS
rpm_abi SUCCESS
rpm_cmd SUCCESS
rpm_files SUCCESS
rpm_header SUCCESS
rpm_lib SUCCESS
rpm_provides SUCCESS
rpm_requires SUCCESS
rpm_symbol SUCCESS
compare_package(aarch64) add_rpms SUCCESS #157
delete_rpms SUCCESS
rpm_abi SUCCESS
rpm_cmd SUCCESS
rpm_files SUCCESS
rpm_header SUCCESS
rpm_lib SUCCESS
rpm_provides SUCCESS
rpm_requires SUCCESS
rpm_symbol SUCCESS
likedislike
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:
likedislike
Hhanjinpeng
12 天前 修改了pull request 的描述
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ai-co-authored
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ai-includes-code
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ai-compliance-failed
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

AI Declaration Check Failed

@protkhn, AI declaration is not compliant. AI tool: DeepSeek

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description.

Details: AI Coding Assistants. ⚠️

likedislike
Hhanjinpeng
12 天前 修改标题为 “fix CVE-2026-39113”,原标题为“fix CVE-2026-39113 for openEuler-24.03-LTS-Next”
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

AI Declaration Check Failed

@protkhn, AI declaration is not compliant. AI tool: DeepSeek Harness

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description.

Details: AI Coding Assistants. ⚠️

likedislike
Hhanjinpeng
12 天前 修改了pull request 的描述
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

AI Declaration Check Failed

@protkhn, AI declaration is not compliant. AI tool: DeepSeek Harness

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description.

Details: AI Coding Assistants. ⚠️

likedislike
Hhanjinpeng
12 天前 update merge request[project id: 7686737, iid: 286, commit_id: 1e3f5e186a4939cecd98b936bb3e3ee4aab5482c] virtual merging success
Hhanjinpeng
12 天前 强制推送  1 个提交:d98fe1ed-fix CVE-2026-39113
Hhanjinpeng
12 天前 update merge request[project id: 7686737, iid: 286, commit_id: 75b3d451eeaa63c4c5b45808afa0ce215b2b7749] virtual merging success
openeuler-ci-botopeneuler-ci-bot成员
12 天前 删除了label:openeuler-cla/yes
openeuler-ci-botopeneuler-ci-bot成员
12 天前 删除了label:ci_successful
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci_successful.

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:openeuler-cla/yes
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

CLA Signature Pass

protkhn, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 删除了label:ai-compliance-failed
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ai-compliance-successful
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/src-openeuler/trigger/sqlite/162/console

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

aarch64架构构建及构建后检查:multiarch/src-openeuler/aarch64/sqlite/162/console

likedislike
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

x86_64架构构建及构建后检查:multiarch/src-openeuler/x86-64/sqlite/162/console

likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 删除了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:
Check Name Build Result 详情 Build Details
check_binary_file SUCCESS #162
check_lfsconfig :ballot_box_with_check:EXCLUDE
check_package_yaml_file SUCCESS
check_repo_in_maintain SUCCESS
check_consistency SUCCESS
check_spec_file SUCCESS
x86_64 check_build SUCCESS #162
check_install SUCCESS
check_license SUCCESS
aarch64 check_build SUCCESS #162
check_install SUCCESS
check_license SUCCESS
likedislike
openeuler-ci-botopeneuler-ci-bot成员
12 天前 添加了label:ci_successful
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:

如下为接口变更检查结果,目标分支为openEuler-24.03-LTS-Next,请PR提交者check差异信息

Arch Name Check Items Rpm Name Check Result Build Details
compare_package(x86_64) add_rpms SUCCESS #162
delete_rpms SUCCESS
rpm_abi SUCCESS
rpm_cmd SUCCESS
rpm_files SUCCESS
rpm_header SUCCESS
rpm_lib SUCCESS
rpm_provides SUCCESS
rpm_requires SUCCESS
rpm_symbol SUCCESS
compare_package(aarch64) add_rpms SUCCESS #162
delete_rpms SUCCESS
rpm_abi SUCCESS
rpm_cmd SUCCESS
rpm_files SUCCESS
rpm_header SUCCESS
rpm_lib SUCCESS
rpm_provides SUCCESS
rpm_requires SUCCESS
rpm_symbol SUCCESS
likedislike
openeuler-ci-bot
openeuler-ci-bot成员
12 天前 评论:
likedislike