Sfoglia il codice sorgente

libobs/util: Fix bug with circlebuf_data

If the index specified is equal to the size of the data, return NULL.
jp9000 7 anni fa
parent
commit
e6c719a1dd
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      libobs/util/circlebuf.h

+ 1 - 1
libobs/util/circlebuf.h

@@ -311,7 +311,7 @@ static inline void *circlebuf_data(struct circlebuf *cb, size_t idx)
 	uint8_t *ptr = (uint8_t*)cb->data;
 	size_t offset = cb->start_pos + idx;
 
-	if (idx > cb->size)
+	if (idx >= cb->size)
 		return NULL;
 
 	if (offset >= cb->capacity)