forked from xbmc/xbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request xbmc#5815 from Memphiz/fixisocrash2
[libdvdread] - fix partial read in file_read
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
see upstream patch here https://mailman.videolan.org/pipermail/libdvdnav-devel/2014-November/000346.html | ||
|
||
diff --git a/lib/libdvd/libdvdread/src/dvd_input.c b/lib/libdvd/libdvdread/src/dvd_input.c | ||
index 4a02524..7efff01 100644 | ||
--- a/lib/libdvd/libdvdread/src/dvd_input.c | ||
+++ b/lib/libdvd/libdvdread/src/dvd_input.c | ||
@@ -217,12 +217,14 @@ static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags) | ||
{ | ||
size_t len; | ||
ssize_t ret; | ||
+ char *buf; | ||
|
||
+ buf = (char*) buffer; | ||
len = (size_t)blocks * DVD_VIDEO_LB_LEN; | ||
|
||
while(len > 0) { | ||
|
||
- ret = read(dev->fd, buffer, len); | ||
+ ret = read(dev->fd, buf, len); | ||
|
||
if(ret < 0) { | ||
/* One of the reads failed, too bad. We won't even bother | ||
@@ -241,6 +243,7 @@ static int file_read(dvd_input_t dev, void *buffer, int blocks, int flags) | ||
return (int) (bytes / DVD_VIDEO_LB_LEN); | ||
} | ||
|
||
+ buf += ret; | ||
len -= ret; | ||
} | ||
|