[libdvdnav-devel] [Git][videolan/libdvdnav][master] Add additional safeguards

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue Jun 7 12:36:31 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdnav


Commits:
6995b0be by Miguel Borges de Freitas at 2022-06-07T12:35:22+00:00
Add additional safeguards

Co-authored-by: Voyager1 voyager at xbmc.org

- - - - -


2 changed files:

- src/dvdnav.c
- src/read_cache.c


Changes:

=====================================
src/dvdnav.c
=====================================
@@ -1426,7 +1426,7 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t* this) {
 
   ops.ops_int = 0;
 
-  if(!this->started) {
+  if(!this || !this->started) {
     printerr("Virtual DVD machine not started.");
     return ops.ops_struct;
   }


=====================================
src/read_cache.c
=====================================
@@ -28,6 +28,7 @@
 #include "config.h"
 #endif
 
+#include <assert.h>
 #include <inttypes.h>
 #include <stdlib.h>
 #include <limits.h>
@@ -335,6 +336,7 @@ dvdnav_status_t dvdnav_free_cache_block(dvdnav_t *self, unsigned char *buf) {
   for (i = 0; i < READ_CACHE_CHUNKS; i++) {
     if (cache->chunk[i].cache_buffer && buf >= cache->chunk[i].cache_buffer &&
         buf < cache->chunk[i].cache_buffer + cache->chunk[i].cache_malloc_size * DVD_VIDEO_LB_LEN) {
+      assert(cache->chunk[i].usage_count > 0);
       cache->chunk[i].usage_count--;
     }
   }



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/6995b0bec10c39f6efdf7def4b81f559b245c231

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/-/commit/6995b0bec10c39f6efdf7def4b81f559b245c231
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdnav-devel mailing list