buffer: Fix incorrect Buffer.compare behavior

Fixes #7551

Signed-off-by: Trevor Norris <trev.norris@gmail.com>