Commit 868d7cc1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix boundary checks on file seek

parent 4df6be77
...@@ -322,12 +322,12 @@ static int Seek (access_t *p_access, int64_t i_pos) ...@@ -322,12 +322,12 @@ static int Seek (access_t *p_access, int64_t i_pos)
{ {
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
if (p_access->info.i_size < p_access->info.i_pos) if (i_pos > p_access->info.i_size)
{ {
msg_Err (p_access, "seeking too far"); msg_Err (p_access, "seeking too far");
i_pos = p_access->info.i_pos = p_access->info.i_size; i_pos = p_access->info.i_pos = p_access->info.i_size;
} }
else if (p_access->info.i_pos < 0) else if (i_pos < 0)
{ {
msg_Err (p_access, "seeking too early"); msg_Err (p_access, "seeking too early");
i_pos = p_access->info.i_pos = 0; i_pos = p_access->info.i_pos = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment