Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
f9b1dbe2
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9b1dbe2
编写于
2月 15, 2022
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
imgcodecs: add runtime checks to validate input
上级
19926e29
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
11 addition
and
3 deletion
+11
-3
modules/imgcodecs/src/grfmt_jpeg2000_openjpeg.cpp
modules/imgcodecs/src/grfmt_jpeg2000_openjpeg.cpp
+1
-1
modules/imgcodecs/src/grfmt_pam.cpp
modules/imgcodecs/src/grfmt_pam.cpp
+8
-0
modules/imgcodecs/src/grfmt_tiff.cpp
modules/imgcodecs/src/grfmt_tiff.cpp
+2
-2
未找到文件。
modules/imgcodecs/src/grfmt_jpeg2000_openjpeg.cpp
浏览文件 @
f9b1dbe2
...
...
@@ -545,7 +545,7 @@ bool Jpeg2KOpjDecoderBase::readHeader()
*/
bool
hasAlpha
=
false
;
const
int
numcomps
=
image_
->
numcomps
;
CV_
Assert
(
numcomps
>=
1
);
CV_
Check
(
numcomps
,
numcomps
>=
1
&&
numcomps
<=
4
,
"Unsupported number of components"
);
for
(
int
i
=
0
;
i
<
numcomps
;
i
++
)
{
const
opj_image_comp_t
&
comp
=
image_
->
comps
[
i
];
...
...
modules/imgcodecs/src/grfmt_pam.cpp
浏览文件 @
f9b1dbe2
...
...
@@ -470,7 +470,11 @@ bool PAMDecoder::readHeader()
selected_fmt
=
IMWRITE_PAM_FORMAT_GRAYSCALE
;
else
if
(
m_channels
==
3
&&
m_maxval
<
256
)
selected_fmt
=
IMWRITE_PAM_FORMAT_RGB
;
else
CV_Error
(
Error
::
StsError
,
"Can't determine selected_fmt (IMWRITE_PAM_FORMAT_NULL)"
);
}
CV_CheckDepth
(
m_sampledepth
,
m_sampledepth
==
CV_8U
||
m_sampledepth
==
CV_16U
,
""
);
CV_Check
(
m_channels
,
m_channels
>=
1
&&
m_channels
<=
4
,
"Unsupported number of channels"
);
m_type
=
CV_MAKETYPE
(
m_sampledepth
,
m_channels
);
m_offset
=
m_strm
.
getPos
();
...
...
@@ -567,6 +571,10 @@ bool PAMDecoder::readData(Mat& img)
FillColorRow1
(
data
,
src
,
m_width
,
palette
);
}
}
else
{
CV_Error
(
Error
::
StsError
,
cv
::
format
(
"Unsupported value of target_channels: %d"
,
target_channels
));
}
}
else
{
for
(
int
y
=
0
;
y
<
m_height
;
y
++
,
data
+=
imp_stride
)
{
...
...
modules/imgcodecs/src/grfmt_tiff.cpp
浏览文件 @
f9b1dbe2
...
...
@@ -149,8 +149,8 @@ bool TiffDecoder::checkSignature( const String& signature ) const
int
TiffDecoder
::
normalizeChannelsNumber
(
int
channels
)
const
{
CV_
Assert
(
channels
<=
4
);
return
channels
>
4
?
4
:
channels
;
CV_
Check
(
channels
,
channels
>=
1
&&
channels
<=
4
,
"Unsupported number of channels"
);
return
channels
;
}
ImageDecoder
TiffDecoder
::
newDecoder
()
const
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录