Skip to content

Commit

Permalink
[xbmc][dvdnav] various safeguards
Browse files Browse the repository at this point in the history
  • Loading branch information
Voyager1 committed Feb 14, 2016
1 parent 27fd0e1 commit b6e55ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/dvdnav.c
Expand Up @@ -1265,6 +1265,11 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t* this) {

ops.ops_int = 0;

if (!this) {
printerr("Passed a NULL pointer.");
return ops.ops_struct;
}

if(!this->started) {
printerr("Virtual DVD machine not started.");
return ops.ops_struct;
Expand Down
2 changes: 1 addition & 1 deletion src/read_cache.c
Expand Up @@ -335,7 +335,7 @@ dvdnav_status_t dvdnav_free_cache_block(dvdnav_t *self, unsigned char *buf) {
pthread_mutex_lock(&cache->lock);
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) {
buf < cache->chunk[i].cache_buffer + cache->chunk[i].cache_malloc_size * DVD_VIDEO_LB_LEN && cache->chunk[i].usage_count > 0) {
cache->chunk[i].usage_count--;
}
}
Expand Down

0 comments on commit b6e55ae

Please sign in to comment.