Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a75552b8
Commit
a75552b8
authored
Mar 06, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HLS: fix IV parsing
Don't assume IV has 32 digits (leading zeroes are not mentioned in the spec)
parent
2f128d59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
+31
-23
modules/stream_filter/httplive.c
modules/stream_filter/httplive.c
+31
-23
No files found.
modules/stream_filter/httplive.c
View file @
a75552b8
...
@@ -502,33 +502,38 @@ static char *parse_Attributes(const char *line, const char *attr)
...
@@ -502,33 +502,38 @@ static char *parse_Attributes(const char *line, const char *attr)
return
NULL
;
return
NULL
;
}
}
static
int
hex2int
(
char
c
)
static
int
string_to_IV
(
char
*
string_hexa
,
uint8_t
iv
[
AES_BLOCK_SIZE
]
)
{
{
if
(
c
>=
'0'
&&
c
<=
'9'
)
unsigned
long
long
iv_hi
,
iv_lo
;
return
c
-
'0'
;
char
*
end
=
NULL
;
if
(
c
>=
'A'
&&
c
<=
'F'
)
if
(
*
string_hexa
++
!=
'0'
)
return
c
-
'A'
+
10
;
if
(
c
>=
'a'
&&
c
<=
'f'
)
return
c
-
'a'
+
10
;
return
-
1
;
}
static
int
string_to_IV
(
const
char
*
string_hexa
,
uint8_t
iv
[
AES_BLOCK_SIZE
])
{
const
char
*
p
=
string_hexa
;
uint8_t
*
d
=
iv
;
unsigned
int
c
;
if
(
*
p
++
!=
'0'
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
if
(
*
p
++
!=
'x
'
)
if
(
*
string_hexa
!=
'x'
&&
*
string_hexa
!=
'X
'
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
while
(
*
p
&&
*
(
p
+
1
))
string_hexa
++
;
{
c
=
hex2int
(
*
p
++
)
<<
4
;
size_t
len
=
strlen
(
string_hexa
);
c
|=
hex2int
(
*
p
++
);
if
(
len
<=
16
)
{
*
d
++
=
c
;
iv_hi
=
0
;
iv_lo
=
strtoull
(
string_hexa
,
&
end
,
16
);
if
(
end
)
return
VLC_EGENERIC
;
}
else
{
iv_lo
=
strtoull
(
&
string_hexa
[
len
-
16
],
NULL
,
16
);
if
(
end
)
return
VLC_EGENERIC
;
string_hexa
[
len
-
16
]
=
'\0'
;
iv_hi
=
strtoull
(
string_hexa
,
NULL
,
16
);
if
(
end
)
return
VLC_EGENERIC
;
}
for
(
int
i
=
8
;
i
;
--
i
)
{
iv
[
i
]
=
iv_hi
&
0xff
;
iv
[
8
+
i
]
=
iv_lo
&
0xff
;
iv_hi
>>=
8
;
iv_lo
>>=
8
;
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -790,7 +795,10 @@ static int parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
...
@@ -790,7 +795,10 @@ static int parse_Key(stream_t *s, hls_stream_t *hls, char *p_read)
*/
*/
if
(
string_to_IV
(
iv
,
hls
->
psz_AES_IV
)
==
VLC_EGENERIC
)
if
(
string_to_IV
(
iv
,
hls
->
psz_AES_IV
)
==
VLC_EGENERIC
)
{
msg_Err
(
s
,
"IV invalid"
);
err
=
VLC_EGENERIC
;
err
=
VLC_EGENERIC
;
}
else
else
hls
->
b_iv_loaded
=
true
;
hls
->
b_iv_loaded
=
true
;
free
(
value
);
free
(
value
);
...
...
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