[libdvdnav-devel] Do not crash in dvdnav_get_next_cache_block if this is NULL

Jean-Baptiste Kempf git at videolan.org
Tue Mar 4 14:51:53 CET 2014


libdvdnav | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Mar  4 14:50:48 2014 +0100| [d6c65547e3ce6728df4cb71f4d60ee8601f56788] | committer: Jean-Baptiste Kempf

Do not crash in dvdnav_get_next_cache_block if this is NULL

The caller shouldn't call this function with a NULL parameter, and is at
fault. But we should not crash

LP: #445980

> http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=d6c65547e3ce6728df4cb71f4d60ee8601f56788
---

 src/dvdnav.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/dvdnav.c b/src/dvdnav.c
index 4f2a34a..97e4920 100644
--- a/src/dvdnav.c
+++ b/src/dvdnav.c
@@ -469,6 +469,9 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
   dvd_state_t *state;
   int32_t result;
 
+  if(!this)
+      return DVDNAV_STATUS_ERR;
+
   pthread_mutex_lock(&this->vm_lock);
 
   if(!this->started) {



More information about the libdvdnav-devel mailing list