Return an error in dvdnav_get_position instead of asserting
libdvdnav | branch: master | Jean-Baptiste Kempf <jb@videolan.org> | Sun Aug 31 00:51:40 2014 +0200| [2d73a2b3c6ccd3d45be194d482cfb09f8e5055e2] | committer: Jean-Baptiste Kempf Return an error in dvdnav_get_position instead of asserting LP: #1236939
http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=2d73a2b3c6ccd3d...
src/searching.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/searching.c b/src/searching.c index f6e497e..74a16ee 100644 --- a/src/searching.c +++ b/src/searching.c @@ -563,7 +563,8 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, uint32_t *pos, *len += cell->last_sector - cell->first_sector + 1; } - assert((signed)*pos != -1); + if((signed)*pos == -1) + return DVDNAV_STATUS_ERR; pthread_mutex_unlock(&this->vm_lock);
On 31/08/14 00:52, Jean-Baptiste Kempf wrote:
libdvdnav | branch: master | Jean-Baptiste Kempf <jb@videolan.org> | Sun Aug 31 00:51:40 2014 +0200| [2d73a2b3c6ccd3d45be194d482cfb09f8e5055e2] | committer: Jean-Baptiste Kempf
Return an error in dvdnav_get_position instead of asserting
LP: #1236939
http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=2d73a2b3c6ccd3d...
src/searching.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/searching.c b/src/searching.c index f6e497e..74a16ee 100644 --- a/src/searching.c +++ b/src/searching.c @@ -563,7 +563,8 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, uint32_t *pos, *len += cell->last_sector - cell->first_sector + 1; }
- assert((signed)*pos != -1); + if((signed)*pos == -1) + return DVDNAV_STATUS_ERR;
pthread_mutex_unlock(&this->vm_lock);
Shouldn't the two new lines come *after* the unlock? Richard.
On 31 Aug, Richard Hulme wrote :
- assert((signed)*pos != -1); + if((signed)*pos == -1) + return DVDNAV_STATUS_ERR;
pthread_mutex_unlock(&this->vm_lock);
Shouldn't the two new lines come *after* the unlock?
Yep. Fixed and Applied. Thanks for noticing, I thought I was a bit lonely on this project :) -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device
participants (3)
-
git@videolan.org -
Jean-Baptiste Kempf -
Richard Hulme