fixes #6200

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

fixes #6200