The bug
Players can bounce on beds even if they don't directly touch the bed's surface. This can be tested by placing a trapdoor above the bed and jumping on the trapdoor; the player will be bounced back up as if he jumped on the bed, not the trapdoor.
This is caused by MC-1133. However, as opposed to that issue, this issue could be prevented by checking whether the player is actually standing on top of the bed (on the correct y coordinate).