fixes #6299

Signed-off-by: Mloc <colmohici@gmail.com>
Merge pull request #6707 from Mloc/bs12-overflow

fixes #6299