The operator[] method of std::vector does not do any bounds checking on the index. It is safer to use the at() method, which does do bounds checking.

Use the at() method, rather than operator[].

Some uses of operator[] are safe because they are protected by a bounds check. The query recognises the following safe coding patterns:

#1706 was caused by a lack of bounds-checking on this array access. The bug was fixed calling the at() method instead.