3.5.x: backport fixes in record layer decoding
This addresses few issues found in record layer decoding. This is a backport of !657 (merged).
- Code modified for feature
- Any issues marked for closing are addressed
- There is a test suite reasonably covering new functionality or modifications
Function naming, parameters, return values, types, etc., are consistent and according to
- This feature/change has adequate documentation added
- No obvious mistakes in the code