From 9d8dbc7e750d446b21a45d813497ea695083539c Mon Sep 17 00:00:00 2001 From: Martin Gerhardy Date: Sun, 3 Jan 2016 16:13:05 +0100 Subject: [PATCH] CAVEPACKER: AddressSanitizer heap-buffer-overflow in BoardState #34 --- src/cavepacker/shared/BoardState.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cavepacker/shared/BoardState.h b/src/cavepacker/shared/BoardState.h index a5741539f..05df29fa8 100644 --- a/src/cavepacker/shared/BoardState.h +++ b/src/cavepacker/shared/BoardState.h @@ -107,6 +107,8 @@ class BoardState { * @return @c false if the conversion failed because the index isn't part of the board */ inline bool getColRowFromIndex(int index, int& col, int& row) const { + if (index < 0 || index >= _state.size()) + return false; if (_state[index] == '\0') return false; col = index % _width;