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
cded4bcd
Commit
cded4bcd
authored
Feb 20, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTP: fix read sizes and signedness (fixes #3302)
parent
44ecbe1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
modules/access/http.c
modules/access/http.c
+25
-24
No files found.
modules/access/http.c
View file @
cded4bcd
...
@@ -761,14 +761,16 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
...
@@ -761,14 +761,16 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
return
0
;
return
0
;
}
}
if
(
p_sys
->
b_has_size
&&
if
(
p_sys
->
b_has_size
)
i_len
+
p_access
->
info
.
i_pos
>
p_access
->
info
.
i_size
)
{
{
if
(
(
i_len
=
p_access
->
info
.
i_size
-
p_access
->
info
.
i_pos
)
==
0
)
/* Remaining bytes in the file */
{
uint64_t
remainder
=
p_access
->
info
.
i_size
-
p_access
->
info
.
i_pos
;
p_access
->
info
.
b_eof
=
true
;
if
(
remainder
<
i_len
)
return
0
;
i_len
=
remainder
;
}
/* Remaining bytes in the response */
if
(
p_sys
->
i_remaining
<
i_len
)
i_len
=
p_sys
->
i_remaining
;
}
}
if
(
p_sys
->
b_chunked
)
if
(
p_sys
->
b_chunked
)
...
@@ -801,19 +803,14 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
...
@@ -801,19 +803,14 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
}
}
if
(
i_len
>
p_sys
->
i_chunk
)
if
(
i_len
>
p_sys
->
i_chunk
)
{
i_len
=
p_sys
->
i_chunk
;
i_len
=
p_sys
->
i_chunk
;
}
}
else
if
(
p_sys
->
b_has_size
&&
i_len
>
p_sys
->
i_remaining
)
{
/* Only ask for the remaining length */
i_len
=
p_sys
->
i_remaining
;
if
(
i_len
==
0
)
{
p_access
->
info
.
b_eof
=
true
;
return
0
;
}
}
}
if
(
i_len
==
0
)
{
p_access
->
info
.
b_eof
=
true
;
return
0
;
}
if
(
p_sys
->
i_icy_meta
>
0
&&
p_access
->
info
.
i_pos
-
p_sys
->
i_icy_offset
>
0
)
if
(
p_sys
->
i_icy_meta
>
0
&&
p_access
->
info
.
i_pos
-
p_sys
->
i_icy_offset
>
0
)
{
{
...
@@ -836,8 +833,6 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
...
@@ -836,8 +833,6 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if
(
i_read
>
0
)
if
(
i_read
>
0
)
{
{
p_access
->
info
.
i_pos
+=
i_read
;
if
(
p_sys
->
b_chunked
)
if
(
p_sys
->
b_chunked
)
{
{
p_sys
->
i_chunk
-=
i_read
;
p_sys
->
i_chunk
-=
i_read
;
...
@@ -849,7 +844,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
...
@@ -849,7 +844,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
}
}
}
}
}
}
else
if
(
i_read
<=
0
)
else
{
{
/*
/*
* I very much doubt that this will work.
* I very much doubt that this will work.
...
@@ -880,15 +875,21 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
...
@@ -880,15 +875,21 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
}
}
}
}
if
(
i_read
==
0
)
if
(
i_read
<=
0
)
{
p_access
->
info
.
b_eof
=
true
;
p_access
->
info
.
b_eof
=
true
;
if
(
i_read
<
0
)
if
(
i_read
<
0
)
p_sys
->
b_error
=
true
;
p_sys
->
b_error
=
true
;
return
0
;
}
}
}
assert
(
i_read
>=
0
);
if
(
p_sys
->
b_has_size
)
if
(
p_sys
->
b_has_size
)
{
{
assert
(
i_read
<=
p_sys
->
i_remaining
);
p_access
->
info
.
i_pos
+=
i_read
;
assert
(
p_access
->
info
.
i_pos
<=
p_access
->
info
.
i_size
);
assert
(
(
unsigned
)
i_read
<=
p_sys
->
i_remaining
);
p_sys
->
i_remaining
-=
i_read
;
p_sys
->
i_remaining
-=
i_read
;
}
}
...
...
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