Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
90a43060
Commit
90a43060
authored
Apr 13, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiffdec: Add a malloc check and refactor another.
parent
99a33529
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
tiff.c
libavcodec/tiff.c
+10
-5
No files found.
libavcodec/tiff.c
View file @
90a43060
...
...
@@ -106,13 +106,18 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
int
c
,
line
,
pixels
,
code
;
const
uint8_t
*
ssrc
=
src
;
int
width
=
((
s
->
width
*
s
->
bpp
)
+
7
)
>>
3
;
#if CONFIG_ZLIB
uint8_t
*
zbuf
;
unsigned
long
outlen
;
if
(
size
<=
0
)
return
AVERROR_INVALIDDATA
;
#if CONFIG_ZLIB
if
(
s
->
compr
==
TIFF_DEFLATE
||
s
->
compr
==
TIFF_ADOBE_DEFLATE
){
uint8_t
*
zbuf
;
unsigned
long
outlen
;
int
ret
;
outlen
=
width
*
lines
;
zbuf
=
av_malloc
(
outlen
);
if
(
!
zbuf
)
return
AVERROR
(
ENOMEM
);
ret
=
tiff_uncompress
(
zbuf
,
&
outlen
,
src
,
size
);
if
(
ret
!=
Z_OK
){
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Uncompressing failed (%lu of %lu) with error %d
\n
"
,
outlen
,
(
unsigned
long
)
width
*
lines
,
ret
);
...
...
@@ -137,11 +142,11 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
}
if
(
s
->
compr
==
TIFF_CCITT_RLE
||
s
->
compr
==
TIFF_G3
||
s
->
compr
==
TIFF_G4
){
int
i
,
ret
=
0
;
uint8_t
*
src2
=
av_malloc
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
uint8_t
*
src2
=
av_malloc
(
(
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
src2
||
(
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
<
(
unsigned
)
size
)
{
if
(
!
src2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error allocating temporary buffer
\n
"
);
return
-
1
;
return
AVERROR
(
ENOMEM
)
;
}
if
(
s
->
fax_opts
&
2
){
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Uncompressed fax mode is not supported (yet)
\n
"
);
...
...
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