Merge pull request #2064 from piki/piki/buffer-corner-cases Fix a couple of corner cases and an undefined behavior