openbsd-ports/multimedia/libdvdnav/patches/patch-src_highlight_c

35 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_highlight_c,v 1.1 2012/09/26 00:04:09 brad Exp $
Pointer validation fixing
--- src/highlight.c.orig Wed Sep 5 14:21:14 2012
+++ src/highlight.c Wed Sep 5 14:21:20 2012
@@ -242,8 +242,13 @@ static btni_t *get_current_button(dvdnav_t *this, pci_
}
static dvdnav_status_t button_auto_action(dvdnav_t *this, pci_t *pci) {
- if (get_current_button(this, pci)->auto_action_mode)
+ btni_t *button_ptr;
+ if ((button_ptr = get_current_button(this, pci)) == NULL)
+ return DVDNAV_STATUS_ERR;
+
+ if (button_ptr->auto_action_mode)
return dvdnav_button_activate(this, pci);
+
return DVDNAV_STATUS_OK;
}
@@ -366,7 +371,11 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this,
return DVDNAV_STATUS_ERR;
}
- button_ptr = get_current_button(this, pci);
+ if ((button_ptr = get_current_button(this, pci)) == NULL) {
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+
/* Finally, make the VM execute the appropriate code and probably
* schedule a jump */
#ifdef BUTTON_TESTING