Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
55ae13e3
Commit
55ae13e3
authored
Oct 22, 2013
by
Derek Buitenhuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nut: Fix unchecked allocations
Signed-off-by:
Derek Buitenhuis
<
derek.buitenhuis@gmail.com
>
parent
692b9309
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
4 deletions
+16
-4
nut.c
libavformat/nut.c
+9
-1
nut.h
libavformat/nut.h
+1
-1
nutdec.c
libavformat/nutdec.c
+4
-1
nutenc.c
libavformat/nutenc.c
+2
-1
No files found.
libavformat/nut.c
View file @
55ae13e3
...
...
@@ -227,11 +227,17 @@ int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b)
return
((
a
->
ts
-
b
->
ts
)
>>
32
)
-
((
b
->
ts
-
a
->
ts
)
>>
32
);
}
void
ff_nut_add_sp
(
NUTContext
*
nut
,
int64_t
pos
,
int64_t
back_ptr
,
int64_t
ts
)
int
ff_nut_add_sp
(
NUTContext
*
nut
,
int64_t
pos
,
int64_t
back_ptr
,
int64_t
ts
)
{
Syncpoint
*
sp
=
av_mallocz
(
sizeof
(
Syncpoint
));
struct
AVTreeNode
*
node
=
av_tree_node_alloc
();
if
(
!
sp
||
!
node
)
{
av_freep
(
&
sp
);
av_freep
(
&
node
);
return
AVERROR
(
ENOMEM
);
}
nut
->
sp_count
++
;
sp
->
pos
=
pos
;
...
...
@@ -242,6 +248,8 @@ void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts)
av_free
(
sp
);
av_free
(
node
);
}
return
0
;
}
static
int
enu_free
(
void
*
opaque
,
void
*
elem
)
...
...
libavformat/nut.h
View file @
55ae13e3
...
...
@@ -122,7 +122,7 @@ void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val);
int64_t
ff_lsb2full
(
StreamContext
*
stream
,
int64_t
lsb
);
int
ff_nut_sp_pos_cmp
(
const
Syncpoint
*
a
,
const
Syncpoint
*
b
);
int
ff_nut_sp_pts_cmp
(
const
Syncpoint
*
a
,
const
Syncpoint
*
b
);
void
ff_nut_add_sp
(
NUTContext
*
nut
,
int64_t
pos
,
int64_t
back_ptr
,
int64_t
ts
);
int
ff_nut_add_sp
(
NUTContext
*
nut
,
int64_t
pos
,
int64_t
back_ptr
,
int64_t
ts
);
void
ff_nut_free_sp
(
NUTContext
*
nut
);
extern
const
Dispositions
ff_nut_dispositions
[];
...
...
libavformat/nutdec.c
View file @
55ae13e3
...
...
@@ -558,6 +558,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
AVIOContext
*
bc
=
s
->
pb
;
int64_t
end
;
uint64_t
tmp
;
int
ret
;
nut
->
last_syncpoint_pos
=
avio_tell
(
bc
)
-
8
;
...
...
@@ -579,7 +580,9 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr)
*
ts
=
tmp
/
nut
->
time_base_count
*
av_q2d
(
nut
->
time_base
[
tmp
%
nut
->
time_base_count
])
*
AV_TIME_BASE
;
ff_nut_add_sp
(
nut
,
nut
->
last_syncpoint_pos
,
*
back_ptr
,
*
ts
);
if
((
ret
=
ff_nut_add_sp
(
nut
,
nut
->
last_syncpoint_pos
,
*
back_ptr
,
*
ts
))
<
0
)
return
ret
;
return
0
;
}
...
...
libavformat/nutenc.c
View file @
55ae13e3
...
...
@@ -858,7 +858,8 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
ff_put_v
(
dyn_bc
,
sp
?
(
nut
->
last_syncpoint_pos
-
sp
->
pos
)
>>
4
:
0
);
put_packet
(
nut
,
bc
,
dyn_bc
,
1
,
SYNCPOINT_STARTCODE
);
ff_nut_add_sp
(
nut
,
nut
->
last_syncpoint_pos
,
0
/*unused*/
,
pkt
->
dts
);
if
((
ret
=
ff_nut_add_sp
(
nut
,
nut
->
last_syncpoint_pos
,
0
/*unused*/
,
pkt
->
dts
))
<
0
)
return
ret
;
if
((
1ll
<<
60
)
%
nut
->
sp_count
==
0
)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
...
...
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