Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
95966689
Unverified
Commit
95966689
authored
Jun 24, 2021
by
cyy
Committed by
GitHub
Jun 24, 2021
Browse files
Raise proper error when decoding 16-bits jpegs (#4101)
parent
d1ab583d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
torchvision/csrc/io/image/cpu/decode_png.cpp
torchvision/csrc/io/image/cpu/decode_png.cpp
+5
-0
No files found.
torchvision/csrc/io/image/cpu/decode_png.cpp
View file @
95966689
...
@@ -71,6 +71,11 @@ torch::Tensor decode_png(const torch::Tensor& data, ImageReadMode mode) {
...
@@ -71,6 +71,11 @@ torch::Tensor decode_png(const torch::Tensor& data, ImageReadMode mode) {
TORCH_CHECK
(
retval
==
1
,
"Could read image metadata from content."
)
TORCH_CHECK
(
retval
==
1
,
"Could read image metadata from content."
)
}
}
if
(
bit_depth
>
8
)
{
png_destroy_read_struct
(
&
png_ptr
,
&
info_ptr
,
nullptr
);
TORCH_CHECK
(
false
,
"At most 8-bit PNG images are supported currently."
)
}
int
channels
=
png_get_channels
(
png_ptr
,
info_ptr
);
int
channels
=
png_get_channels
(
png_ptr
,
info_ptr
);
if
(
color_type
==
PNG_COLOR_TYPE_GRAY
&&
bit_depth
<
8
)
if
(
color_type
==
PNG_COLOR_TYPE_GRAY
&&
bit_depth
<
8
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment