make numberOfThreeBitSectionsInCode() robust against overflowing buffers if length is known
Merge pull request #1184 from ZappoMan/bugfixes

make numberOfThreeBitSectionsInCode() robust against overflowing buffers if length is known