On 5 November 2015 at 12:13, Paolo Bonzini <pbonz...@redhat.com> wrote:
> From: Pavel Dovgalyuk <pavel.dovga...@ispras.ru>
>
> This patch adds functions to perform read and write operations
> with replay log.
>
> Reviewed-by: Paolo Bonzini <pbonz...@redhat.com>

> +void replay_put_byte(uint8_t byte)
> +{
> +    if (replay_file) {
> +        putc(byte, replay_file);
> +    }
> +}

> +uint8_t replay_get_byte(void)
> +{
> +    uint8_t byte = 0;
> +    if (replay_file) {
> +        byte = getc(replay_file);
> +    }
> +    return byte;
> +}

Coverity (CID 1390576) points out that this function isn't checking
the error return from getc(). That means we could incorrectly return
255 from here and then the return value from replay_get_dword would
be 0xffffffff, which is unfortunate if the place that's using
that uses it as a loop boundary.

Incidentally, is it worth adding something to our coverity model
to tell coverity that data from replay_get_byte() is not tainted?

thanks
-- PMM

Reply via email to