Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
103ab870
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
103ab870
编写于
4月 08, 2021
作者:
T
Tom Deseyn
提交者:
GitHub
4月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cruntime/*printf*: free temporary string buffers also on failure (#50469)
上级
c38b7c33
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
14 deletion
+25
-14
src/coreclr/pal/src/cruntime/printf.cpp
src/coreclr/pal/src/cruntime/printf.cpp
+4
-2
src/coreclr/pal/src/cruntime/printfcpp.cpp
src/coreclr/pal/src/cruntime/printfcpp.cpp
+17
-10
src/coreclr/pal/src/cruntime/silent_printf.cpp
src/coreclr/pal/src/cruntime/silent_printf.cpp
+4
-2
未找到文件。
src/coreclr/pal/src/cruntime/printf.cpp
浏览文件 @
103ab870
...
...
@@ -303,7 +303,7 @@ static BOOL Internal_ScanfExtractFormatW(LPCWSTR *Fmt, LPSTR Out, int iOutSize,
{
ERROR
(
"atoi returned a negative value indicative of an overflow.
\n
"
);
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
...
...
@@ -401,7 +401,7 @@ static BOOL Internal_ScanfExtractFormatW(LPCWSTR *Fmt, LPSTR Out, int iOutSize,
{
ERROR
(
"strcpy_s failed
\n
"
);
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
FALSE
;
goto
EXIT
;
}
Out
+=
strlen
(
scanf_longlongfmt
);
...
...
@@ -532,6 +532,8 @@ static BOOL Internal_ScanfExtractFormatW(LPCWSTR *Fmt, LPSTR Out, int iOutSize,
*
Out
++
=
'n'
;
*
Out
=
0
;
/* end the string */
EXIT:
PAL_free
(
TempStr
);
return
Result
;
}
...
...
src/coreclr/pal/src/cruntime/printfcpp.cpp
浏览文件 @
103ab870
...
...
@@ -220,7 +220,7 @@ BOOL Internal_ExtractFormatA(CPalThread *pthrCurrent, LPCSTR *Fmt, LPSTR Out, LP
{
ERROR
(
"atoi returned a negative value indicative of an overflow.
\n
"
);
pthrCurrent
->
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -258,7 +258,7 @@ BOOL Internal_ExtractFormatA(CPalThread *pthrCurrent, LPCSTR *Fmt, LPSTR Out, LP
{
ERROR
(
"atoi returned a negative value indicative of an overflow.
\n
"
);
pthrCurrent
->
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -444,6 +444,8 @@ BOOL Internal_ExtractFormatA(CPalThread *pthrCurrent, LPCSTR *Fmt, LPSTR Out, LP
}
*
Out
=
0
;
/* end the string */
EXIT:
free
(
TempStr
);
return
Result
;
}
...
...
@@ -525,7 +527,7 @@ BOOL Internal_ExtractFormatW(CPalThread *pthrCurrent, LPCWSTR *Fmt, LPSTR Out, L
{
ERROR
(
"atoi returned a negative value indicative of an overflow.
\n
"
);
pthrCurrent
->
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -562,7 +564,7 @@ BOOL Internal_ExtractFormatW(CPalThread *pthrCurrent, LPCWSTR *Fmt, LPSTR Out, L
{
ERROR
(
"atoi returned a negative value indicative of an overflow.
\n
"
);
pthrCurrent
->
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -772,6 +774,8 @@ BOOL Internal_ExtractFormatW(CPalThread *pthrCurrent, LPCWSTR *Fmt, LPSTR Out, L
}
*
Out
=
0
;
/* end the string */
EXIT:
free
(
TempStr
);
return
Result
;
}
...
...
@@ -899,7 +903,7 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
LPWSTR
OutOriginal
;
INT
LengthInStr
;
INT
Length
;
INT
Written
=
0
;
INT
Written
=
-
1
;
LengthInStr
=
PAL_wcslen
(
In
);
Length
=
LengthInStr
;
...
...
@@ -924,9 +928,8 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
if
(
wcscpy_s
(
Out
,
iLen
,
In
)
!=
SAFECRT_SUCCESS
)
{
ERROR
(
"wcscpy_s failed!
\n
"
);
free
(
OutOriginal
);
pthrCurrent
->
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
-
1
;
goto
EXIT
;
}
Out
+=
LengthInStr
;
iLen
-=
LengthInStr
;
...
...
@@ -954,9 +957,8 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
if
(
wcscpy_s
(
Out
,
iLen
,
In
)
!=
SAFECRT_SUCCESS
)
{
ERROR
(
"wcscpy_s failed!
\n
"
);
free
(
OutOriginal
);
pthrCurrent
->
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
-
1
;
goto
EXIT
;
}
Out
+=
LengthInStr
;
...
...
@@ -971,9 +973,14 @@ static INT Internal_AddPaddingVfwprintf(CPalThread *pthrCurrent, PAL_FILE *strea
{
ERROR
(
"fwrite() failed with errno == %d
\n
"
,
errno
);
}
free
(
OutOriginal
);
}
else
{
Written
=
0
;
}
EXIT:
free
(
OutOriginal
);
return
Written
;
}
...
...
src/coreclr/pal/src/cruntime/silent_printf.cpp
浏览文件 @
103ab870
...
...
@@ -402,7 +402,7 @@ BOOL Silent_ExtractFormatA(LPCSTR *Fmt, LPSTR Out, LPINT Flags, LPINT Width, LPI
if
(
*
Width
<
0
)
{
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -439,7 +439,7 @@ BOOL Silent_ExtractFormatA(LPCSTR *Fmt, LPSTR Out, LPINT Flags, LPINT Width, LPI
if
(
*
Precision
<
0
)
{
SetLastError
(
ERROR_INTERNAL_ERROR
);
return
Result
;
goto
EXIT
;
}
}
else
if
(
**
Fmt
==
'*'
)
...
...
@@ -595,6 +595,8 @@ BOOL Silent_ExtractFormatA(LPCSTR *Fmt, LPSTR Out, LPINT Flags, LPINT Width, LPI
}
*
Out
=
0
;
/* end the string */
EXIT:
PAL_free
(
TempStr
);
return
Result
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录