Merge pull request #130 from glyptodon/out-of-bounds
GUAC-236: Do not exceed available buffers/layers/streams.
This commit is contained in:
commit
3614c48240
@ -37,7 +37,7 @@ guacenc_buffer* guacenc_display_get_buffer(guacenc_display* display,
|
|||||||
int internal_index = -index - 1;
|
int internal_index = -index - 1;
|
||||||
|
|
||||||
/* Do not lookup / allocate if index is invalid */
|
/* Do not lookup / allocate if index is invalid */
|
||||||
if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) {
|
if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ int guacenc_display_free_buffer(guacenc_display* display,
|
|||||||
int internal_index = -index - 1;
|
int internal_index = -index - 1;
|
||||||
|
|
||||||
/* Do not lookup / free if index is invalid */
|
/* Do not lookup / free if index is invalid */
|
||||||
if (internal_index < 0 || internal_index > GUACENC_DISPLAY_MAX_BUFFERS) {
|
if (internal_index < 0 || internal_index >= GUACENC_DISPLAY_MAX_BUFFERS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Buffer index out of bounds: %i", index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ int guacenc_display_create_image_stream(guacenc_display* display, int index,
|
|||||||
int mask, int layer_index, const char* mimetype, int x, int y) {
|
int mask, int layer_index, const char* mimetype, int x, int y) {
|
||||||
|
|
||||||
/* Do not lookup / allocate if index is invalid */
|
/* Do not lookup / allocate if index is invalid */
|
||||||
if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
|
if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ guacenc_image_stream* guacenc_display_get_image_stream(
|
|||||||
guacenc_display* display, int index) {
|
guacenc_display* display, int index) {
|
||||||
|
|
||||||
/* Do not lookup / allocate if index is invalid */
|
/* Do not lookup / allocate if index is invalid */
|
||||||
if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
|
if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ guacenc_image_stream* guacenc_display_get_image_stream(
|
|||||||
int guacenc_display_free_image_stream(guacenc_display* display, int index) {
|
int guacenc_display_free_image_stream(guacenc_display* display, int index) {
|
||||||
|
|
||||||
/* Do not lookup / allocate if index is invalid */
|
/* Do not lookup / allocate if index is invalid */
|
||||||
if (index < 0 || index > GUACENC_DISPLAY_MAX_STREAMS) {
|
if (index < 0 || index >= GUACENC_DISPLAY_MAX_STREAMS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Stream index out of bounds: %i", index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ guacenc_layer* guacenc_display_get_layer(guacenc_display* display,
|
|||||||
int index) {
|
int index) {
|
||||||
|
|
||||||
/* Do not lookup / allocate if index is invalid */
|
/* Do not lookup / allocate if index is invalid */
|
||||||
if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) {
|
if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ int guacenc_display_free_layer(guacenc_display* display,
|
|||||||
int index) {
|
int index) {
|
||||||
|
|
||||||
/* Do not lookup / free if index is invalid */
|
/* Do not lookup / free if index is invalid */
|
||||||
if (index < 0 || index > GUACENC_DISPLAY_MAX_LAYERS) {
|
if (index < 0 || index >= GUACENC_DISPLAY_MAX_LAYERS) {
|
||||||
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
|
guacenc_log(GUAC_LOG_WARNING, "Layer index out of bounds: %i", index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user