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
52ca31e6
Commit
52ca31e6
authored
Jun 20, 2008
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check memory allocations.
parent
69afa855
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
20 deletions
+36
-20
modules/demux/ps.c
modules/demux/ps.c
+2
-0
modules/demux/ps.h
modules/demux/ps.h
+34
-20
No files found.
modules/demux/ps.c
View file @
52ca31e6
...
...
@@ -124,6 +124,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
Control
;
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
/* Init p_sys */
p_sys
->
i_mux_rate
=
0
;
...
...
@@ -559,6 +560,7 @@ static block_t *ps_pkt_read( stream_t *s, uint32_t i_code )
const
uint8_t
*
p_peek
;
int
i_peek
=
stream_Peek
(
s
,
&
p_peek
,
14
);
int
i_size
=
ps_pkt_size
(
p_peek
,
i_peek
);
VLC_UNUSED
(
i_code
);
if
(
i_size
<=
6
&&
p_peek
[
3
]
>
0xba
)
{
...
...
modules/demux/ps.h
View file @
52ca31e6
...
...
@@ -168,8 +168,11 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
if
(
ps_id_to_lang
(
p_psm
,
i_id
)
)
{
tk
->
fmt
.
psz_language
=
malloc
(
4
);
memcpy
(
tk
->
fmt
.
psz_language
,
ps_id_to_lang
(
p_psm
,
i_id
),
3
);
tk
->
fmt
.
psz_language
[
3
]
=
0
;
if
(
tk
->
fmt
.
psz_language
)
{
memcpy
(
tk
->
fmt
.
psz_language
,
ps_id_to_lang
(
p_psm
,
i_id
),
3
);
tk
->
fmt
.
psz_language
[
3
]
=
0
;
}
}
return
VLC_SUCCESS
;
...
...
@@ -534,6 +537,7 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
while
(
i_es_base
+
4
<
i_length
)
{
ps_es_t
**
tmp_es
;
ps_es_t
es
;
es
.
lang
[
0
]
=
es
.
lang
[
1
]
=
es
.
lang
[
2
]
=
0
;
...
...
@@ -556,31 +560,41 @@ static inline int ps_psm_fill( ps_psm_t *p_psm, block_t *p_pkt,
int
i
=
0
;
es
.
p_descriptor
=
malloc
(
i_info_length
);
memcpy
(
es
.
p_descriptor
,
p_buffer
+
i_es_base
+
4
,
i_info_length
);
while
(
i
<=
es
.
i_descriptor
-
2
)
if
(
es
.
p_descriptor
)
{
/* Look for the ISO639 language descriptor */
if
(
es
.
p_descriptor
[
i
]
!=
0x0a
)
{
i
+=
es
.
p_descriptor
[
i
+
1
]
+
2
;
continue
;
}
memcpy
(
es
.
p_descriptor
,
p_buffer
+
i_es_base
+
4
,
i_info_length
);
if
(
i
<=
es
.
i_descriptor
-
6
)
while
(
i
<=
es
.
i_descriptor
-
2
)
{
es
.
lang
[
0
]
=
es
.
p_descriptor
[
i
+
2
];
es
.
lang
[
1
]
=
es
.
p_descriptor
[
i
+
3
];
es
.
lang
[
2
]
=
es
.
p_descriptor
[
i
+
4
];
/* Look for the ISO639 language descriptor */
if
(
es
.
p_descriptor
[
i
]
!=
0x0a
)
{
i
+=
es
.
p_descriptor
[
i
+
1
]
+
2
;
continue
;
}
if
(
i
<=
es
.
i_descriptor
-
6
)
{
es
.
lang
[
0
]
=
es
.
p_descriptor
[
i
+
2
];
es
.
lang
[
1
]
=
es
.
p_descriptor
[
i
+
3
];
es
.
lang
[
2
]
=
es
.
p_descriptor
[
i
+
4
];
}
break
;
}
break
;
}
}
p_psm
->
es
=
realloc
(
p_psm
->
es
,
sizeof
(
ps_es_t
*
)
*
(
p_psm
->
i_es
+
1
)
);
p_psm
->
es
[
p_psm
->
i_es
]
=
malloc
(
sizeof
(
ps_es_t
)
);
*
p_psm
->
es
[
p_psm
->
i_es
++
]
=
es
;
i_es_base
+=
4
+
i_info_length
;
tmp_es
=
realloc
(
p_psm
->
es
,
sizeof
(
ps_es_t
*
)
*
(
p_psm
->
i_es
+
1
)
);
if
(
tmp_es
)
{
p_psm
->
es
=
tmp_es
;
p_psm
->
es
[
p_psm
->
i_es
]
=
malloc
(
sizeof
(
ps_es_t
)
);
if
(
p_psm
->
es
[
p_psm
->
i_es
]
)
{
*
p_psm
->
es
[
p_psm
->
i_es
++
]
=
es
;
i_es_base
+=
4
+
i_info_length
;
}
}
}
/* TODO: CRC */
...
...
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