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
b9755cd0
Commit
b9755cd0
authored
Mar 20, 2013
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dr_56: add boundary checking
parent
e9df3130
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
src/descriptors/dr_56.c
src/descriptors/dr_56.c
+7
-3
src/descriptors/dr_56.h
src/descriptors/dr_56.h
+8
-3
No files found.
src/descriptors/dr_56.c
View file @
b9755cd0
...
@@ -62,15 +62,16 @@ dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
...
@@ -62,15 +62,16 @@ dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
if
(
p_descriptor
->
i_length
%
5
)
if
(
p_descriptor
->
i_length
%
5
)
return
NULL
;
return
NULL
;
int
i_pages_number
;
i_pages_number
=
p_descriptor
->
i_length
/
5
;
/* Allocate memory */
/* Allocate memory */
dvbpsi_teletext_dr_t
*
p_decoded
;
dvbpsi_teletext_dr_t
*
p_decoded
;
p_decoded
=
(
dvbpsi_teletext_dr_t
*
)
malloc
(
sizeof
(
dvbpsi_teletext_dr_t
));
p_decoded
=
(
dvbpsi_teletext_dr_t
*
)
malloc
(
sizeof
(
dvbpsi_teletext_dr_t
));
if
(
!
p_decoded
)
if
(
!
p_decoded
)
return
NULL
;
return
NULL
;
int
i_pages_number
;
i_pages_number
=
p_descriptor
->
i_length
/
5
;
if
(
i_pages_number
>
DVBPSI_TELETEXT_DR_MAX
)
i_pages_number
=
DVBPSI_TELETEXT_DR_MAX
;
p_decoded
->
i_pages_number
=
i_pages_number
;
p_decoded
->
i_pages_number
=
i_pages_number
;
for
(
int
i
=
0
;
i
<
i_pages_number
;
i
++
)
for
(
int
i
=
0
;
i
<
i_pages_number
;
i
++
)
...
@@ -99,6 +100,9 @@ dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
...
@@ -99,6 +100,9 @@ dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
dvbpsi_descriptor_t
*
dvbpsi_GenTeletextDr
(
dvbpsi_teletext_dr_t
*
p_decoded
,
dvbpsi_descriptor_t
*
dvbpsi_GenTeletextDr
(
dvbpsi_teletext_dr_t
*
p_decoded
,
bool
b_duplicate
)
bool
b_duplicate
)
{
{
if
(
p_decoded
->
i_pages_number
>
DVBPSI_TELETEXT_DR_MAX
)
p_decoded
->
i_pages_number
=
DVBPSI_TELETEXT_DR_MAX
;
/* Create the descriptor */
/* Create the descriptor */
dvbpsi_descriptor_t
*
p_descriptor
=
dvbpsi_descriptor_t
*
p_descriptor
=
dvbpsi_NewDescriptor
(
0x56
,
p_decoded
->
i_pages_number
*
8
,
NULL
);
dvbpsi_NewDescriptor
(
0x56
,
p_decoded
->
i_pages_number
*
8
,
NULL
);
...
...
src/descriptors/dr_56.h
View file @
b9755cd0
...
@@ -62,6 +62,12 @@ typedef struct dvbpsi_teletextpage_s
...
@@ -62,6 +62,12 @@ typedef struct dvbpsi_teletextpage_s
}
dvbpsi_teletextpage_t
;
}
dvbpsi_teletextpage_t
;
/*!
* \def DVBPSI_TELETEXT_DR_MAX
* \brief Maximum number of dvbpsi_teletextpage_t entries present in
* @see dvbpsi_teletext_dr_t
*/
#define DVBPSI_TELETEXT_DR_MAX 64
/*****************************************************************************
/*****************************************************************************
* dvbpsi_teletext_dr_t
* dvbpsi_teletext_dr_t
...
@@ -80,11 +86,10 @@ typedef struct dvbpsi_teletextpage_s
...
@@ -80,11 +86,10 @@ typedef struct dvbpsi_teletextpage_s
typedef
struct
dvbpsi_teletext_dr_s
typedef
struct
dvbpsi_teletext_dr_s
{
{
uint8_t
i_pages_number
;
/*!< number of pages */
uint8_t
i_pages_number
;
/*!< number of pages */
dvbpsi_teletextpage_t
p_pages
[
64
];
/*!< teletext pages */
dvbpsi_teletextpage_t
p_pages
[
DVBPSI_TELETEXT_DR_MAX
];
/*!< teletext pages */
}
dvbpsi_teletext_dr_t
;
}
dvbpsi_teletext_dr_t
;
/*****************************************************************************
/*****************************************************************************
* dvbpsi_DecodeTeletextDataDr
* dvbpsi_DecodeTeletextDataDr
*****************************************************************************/
*****************************************************************************/
...
...
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