1 Star 0 Fork 21

sigui/tcl

forked from src-openEuler/tcl 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Improved-overflow-prevention-1.patch 763 Bytes
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 11:18 . Package init
From 5dfa918023df4ec9c5cbd4fe567ee509328f8d4f Mon Sep 17 00:00:00 2001
From: dgp <[email protected]>
Date: Mon, 5 Feb 2018 13:33:21 +0000
Subject: [PATCH 0878/1800] Improved overflow prevention.
---
generic/tclStringObj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index ae75e449e..8437555ed 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -140,8 +140,8 @@ GrowStringBuffer(
objPtr->bytes = NULL;
}
if (flag == 0 || stringPtr->allocated > 0) {
- attempt = 2 * needed;
- if (attempt >= 0) {
+ if (needed <= INT_MAX / 2) {
+ attempt = 2 * needed;
ptr = attemptckrealloc(objPtr->bytes, attempt + 1);
}
if (ptr == NULL) {
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/si-gui/tcl.git
[email protected]:si-gui/tcl.git
si-gui
tcl
tcl
master

搜索帮助