Pass a buffer to mad_stream_buffer which ends exactly on a frame boundary. mad_frame_decode will fail on the last frame and set the error to MAD_ERROR_BUFLEN even though entire frame is there. As much as 7 extra bytes can be added to the end of the buffer and the last frame decode will still fail. If 8 bytes are added, the frame decode will succeed.
Is this a bug or by design? If by design, how can I decode the last frame without adding padding after it?