Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
0bdd0e63
Commit
0bdd0e63
authored
Aug 31, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
image: fix error cases
parent
b4b8a826
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
src/misc/image.c
src/misc/image.c
+18
-9
No files found.
src/misc/image.c
View file @
0bdd0e63
...
...
@@ -35,6 +35,7 @@
#endif
#include <errno.h>
#include <limits.h>
#include <vlc_common.h>
#include <vlc_codec.h>
...
...
@@ -228,7 +229,7 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
block_t
*
p_block
;
picture_t
*
p_pic
;
stream_t
*
p_stream
=
NULL
;
in
t
i_size
;
uint64_
t
i_size
;
p_stream
=
stream_UrlNew
(
p_image
->
p_parent
,
psz_url
);
...
...
@@ -239,20 +240,25 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
return
NULL
;
}
i_size
=
stream_Size
(
p_stream
);
p_block
=
block_Alloc
(
i_size
);
if
(
stream_GetSize
(
p_stream
,
&
i_size
)
||
i_size
>
SSIZE_MAX
)
{
msg_Dbg
(
p_image
->
p_parent
,
"could not read %s"
,
psz_url
);
goto
error
;
}
stream_Read
(
p_stream
,
p_block
->
p_buffer
,
i_size
);
p_block
=
stream_Block
(
p_stream
,
i_size
);
if
(
p_block
==
NULL
)
goto
error
;
if
(
!
p_fmt_in
->
i_chroma
)
{
char
*
psz_mime
=
NULL
;
stream_Control
(
p_stream
,
STREAM_GET_CONTENT_TYPE
,
&
psz_mime
);
if
(
psz_mime
)
char
*
psz_mime
=
stream_ContentType
(
p_stream
)
;
if
(
psz_mime
!=
NULL
)
{
p_fmt_in
->
i_chroma
=
image_Mime2Fourcc
(
psz_mime
);
free
(
psz_mime
);
}
}
stream_Delete
(
p_stream
);
if
(
!
p_fmt_in
->
i_chroma
)
...
...
@@ -264,6 +270,9 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
p_pic
=
ImageRead
(
p_image
,
p_block
,
p_fmt_in
,
p_fmt_out
);
return
p_pic
;
error:
stream_Delete
(
p_stream
);
return
NULL
;
}
/**
...
...
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