Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
638023d7
Commit
638023d7
authored
Feb 25, 2007
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a memory access error (net_ReadInner)
parent
2814beeb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
+31
-28
src/network/io.c
src/network/io.c
+31
-28
No files found.
src/network/io.c
View file @
638023d7
...
...
@@ -282,22 +282,22 @@ void net_Close (int fd)
}
static
ssize_t
net_ReadInner
(
vlc_object_t
*
restrict
p_this
,
unsigned
fdc
,
const
int
*
fdv
,
const
v_socket_t
*
const
*
restrict
vsv
,
uint8_t
*
restrict
p_buf
,
size_t
i_buflen
,
vlc_bool_t
dontwait
,
vlc_bool_t
waitall
)
static
ssize_t
net_ReadInner
(
vlc_object_t
*
restrict
p_this
,
unsigned
i_fdc
,
const
int
*
p_
fdv
,
const
v_socket_t
*
const
*
restrict
pp_
vsv
,
uint8_t
*
restrict
p_buf
,
size_t
i_buflen
,
vlc_bool_t
dontwait
,
vlc_bool_t
waitall
)
{
size_t
i_total
=
0
;
while
(
i_buflen
>
0
)
while
(
i_buflen
>
0
)
{
unsigned
i
;
unsigned
i
nt
i
;
ssize_t
n
;
struct
pollfd
ufd
[
fdc
];
struct
pollfd
ufd
[
i_
fdc
];
int
delay_ms
=
dontwait
?
0
:
500
;
if
(
p_this
->
b_die
)
if
(
p_this
->
b_die
)
{
#if defined(WIN32) || defined(UNDER_CE)
WSASetLastError
(
WSAEINTR
);
...
...
@@ -309,45 +309,48 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
memset
(
ufd
,
0
,
sizeof
(
ufd
));
for
(
i
=
0
;
i
<
fdc
;
i
++
)
for
(
i
=
0
;
i
<
i_
fdc
;
i
++
)
{
ufd
[
i
].
fd
=
fdv
[
i
];
ufd
[
i
].
fd
=
p_
fdv
[
i
];
ufd
[
i
].
events
=
POLLIN
;
}
n
=
poll
(
ufd
,
fdc
,
delay_ms
);
n
=
poll
(
ufd
,
i_
fdc
,
delay_ms
);
if
(
n
==
-
1
)
goto
error
;
assert
((
unsigned
)
n
<=
fdc
);
assert
((
unsigned
)
n
<=
i_
fdc
);
if
(
n
==
0
)
// timeout
if
(
n
==
0
)
// timeout
continue
;
for
(
i
=
0
;;
i
++
)
for
(
i
=
0
;
i
<
i_fdc
;
i
++
)
{
if
((
i_total
>
0
)
&&
(
ufd
[
i
].
revents
&
POLLERR
)
)
if
(
i_total
>
0
&&
(
ufd
[
i
].
revents
&
POLLERR
)
)
return
i_total
;
// error will be dequeued on next run
if
((
ufd
[
i
].
revents
&
POLLIN
)
==
0
)
if
(
(
ufd
[
i
].
revents
&
POLLIN
)
==
0
)
continue
;
fdc
=
1
;
fdv
+=
i
;
vsv
+=
i
;
/* */
i_fdc
=
1
;
p_fdv
=
&
p_fdv
[
i
];
pp_vsv
=
&
pp_vsv
[
i
];
break
;
}
if
(
i
>=
i_fdc
)
continue
;
if
(
(
*
vsv
)
!=
NULL
)
if
(
(
*
pp_
vsv
)
!=
NULL
)
{
n
=
(
*
vsv
)
->
pf_recv
(
(
*
vsv
)
->
p_sys
,
p_buf
,
i_buflen
);
n
=
(
*
pp_vsv
)
->
pf_recv
(
(
*
pp_
vsv
)
->
p_sys
,
p_buf
,
i_buflen
);
}
else
{
#if defined(WIN32) || defined(UNDER_CE)
n
=
recv
(
*
fdv
,
p_buf
,
i_buflen
,
0
);
n
=
recv
(
*
p_
fdv
,
p_buf
,
i_buflen
,
0
);
#else
n
=
read
(
*
fdv
,
p_buf
,
i_buflen
);
n
=
read
(
*
p_
fdv
,
p_buf
,
i_buflen
);
#endif
}
...
...
@@ -374,26 +377,26 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
goto
error
;
}
#else
if
(
errno
==
EAGAIN
)
/* spurious wake-up (sucks if fdc > 1) */
if
(
errno
==
EAGAIN
)
/* spurious wake-up (sucks if
i_
fdc > 1) */
continue
;
goto
error
;
#endif
}
if
(
n
==
0
)
// EOF
if
(
n
==
0
)
// EOF
break
;
i_total
+=
n
;
p_buf
+=
n
;
i_buflen
-=
n
;
if
(
dontwait
||
!
waitall
)
if
(
dontwait
||
!
waitall
)
break
;
}
return
i_total
;
error:
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
)
);
msg_Err
(
p_this
,
"Read error: %s"
,
net_strerror
(
net_errno
)
);
return
i_total
?
(
ssize_t
)
i_total
:
-
1
;
}
...
...
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