change reading order from beginning at the end to beginning at a buffer start added intergration tests for boundary cases Removed whitespace Signed-off-by: Shayne Wang <shaynexwang@gmail.com> Upstream-commit: 63904eb6745d553573ffe8b7cef43dfc0b8a07cf Component: engine