Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
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
libdvbpsi
Commits
805c3910
Commit
805c3910
authored
Mar 20, 2013
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dr_45: Add boundary checking
parent
74207500
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
src/descriptors/dr_45.c
src/descriptors/dr_45.c
+10
-0
src/descriptors/dr_45.h
src/descriptors/dr_45.h
+15
-1
No files found.
src/descriptors/dr_45.c
View file @
805c3910
...
...
@@ -63,6 +63,8 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
/* */
dvbpsi_vbi_dr_t
*
p_decoded
;
int
i_services_number
=
p_descriptor
->
i_length
/
2
;
if
(
i_services_number
>
DVBPSI_VBI_DR_MAX
)
i_services_number
=
DVBPSI_VBI_DR_MAX
;
/* Allocate memory */
p_decoded
=
(
dvbpsi_vbi_dr_t
*
)
malloc
(
sizeof
(
dvbpsi_vbi_dr_t
));
...
...
@@ -79,6 +81,8 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
p_decoded
->
p_services
[
i
].
i_data_service_id
=
i_data_service_id
;
i_lines
=
((
uint8_t
)(
p_descriptor
->
p_data
[
3
*
i
+
3
]));
if
(
i_lines
>
DVBPSI_VBIDATA_LINE_DR_MAX
)
i_lines
=
DVBPSI_VBIDATA_LINE_DR_MAX
;
p_decoded
->
p_services
[
i
].
i_lines
=
i_lines
;
for
(
int
n
=
0
;
n
<
i_lines
;
n
++
)
{
...
...
@@ -103,6 +107,9 @@ dvbpsi_vbi_dr_t * dvbpsi_DecodeVBIDataDr(
dvbpsi_descriptor_t
*
dvbpsi_GenVBIDataDr
(
dvbpsi_vbi_dr_t
*
p_decoded
,
bool
b_duplicate
)
{
if
(
p_decoded
->
i_services_number
>
DVBPSI_VBI_DR_MAX
)
p_decoded
->
i_services_number
=
DVBPSI_VBI_DR_MAX
;
/* Create the descriptor */
dvbpsi_descriptor_t
*
p_descriptor
=
dvbpsi_NewDescriptor
(
0x45
,
p_decoded
->
i_services_number
*
5
,
NULL
);
...
...
@@ -115,6 +122,9 @@ dvbpsi_descriptor_t * dvbpsi_GenVBIDataDr(dvbpsi_vbi_dr_t * p_decoded,
p_descriptor
->
p_data
[
5
*
i
+
3
]
=
(
(
uint8_t
)
p_decoded
->
p_services
[
i
].
i_data_service_id
);
if
(
p_decoded
->
p_services
[
i
].
i_lines
>
DVBPSI_VBIDATA_LINE_DR_MAX
)
p_decoded
->
p_services
[
i
].
i_lines
=
DVBPSI_VBIDATA_LINE_DR_MAX
;
p_descriptor
->
p_data
[
5
*
i
+
4
]
=
p_decoded
->
p_services
[
i
].
i_lines
;
for
(
int
n
=
0
;
n
<
p_decoded
->
p_services
[
i
].
i_lines
;
n
++
)
{
...
...
src/descriptors/dr_45.h
View file @
805c3910
...
...
@@ -60,6 +60,13 @@ typedef struct dvbpsi_vbidata_line_s
}
dvbpsi_vbidata_line_t
;
/*!
* \def DVBPSI_VBIDATA_LINE_DR_MAX
* \brief Maximum number of dvbpsi_vbidata_line_t entries present in
* @see dvbpsi_vbidata_t
*/
#define DVBPSI_VBIDATA_LINE_DR_MAX 255
/*****************************************************************************
* dvbpsi_vbidata_t
*****************************************************************************/
...
...
@@ -82,6 +89,13 @@ typedef struct dvbpsi_vbidata_s
}
dvbpsi_vbidata_t
;
/*!
* \def DVBPSI_VBI_DR_MAX
* \brief Maximum number of dvbpsi_vbidata_t entries present in
* @see dvbpsi_vbi_dr_t
*/
#define DVBPSI_VBI_DR_MAX 85
/*****************************************************************************
* dvbpsi_vbi_dr_t
*****************************************************************************/
...
...
@@ -99,7 +113,7 @@ typedef struct dvbpsi_vbidata_s
typedef
struct
dvbpsi_vbi_dr_s
{
uint8_t
i_services_number
;
/*!< service number */
dvbpsi_vbidata_t
p_services
[
85
];
/*!< services table */
dvbpsi_vbidata_t
p_services
[
DVBPSI_VBI_DR_MAX
];
/*!< services table */
}
dvbpsi_vbi_dr_t
;
...
...
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