Skip to content
Commit c1fd9f5d authored by Tobias Mueller's avatar Tobias Mueller Committed by Bastien Nocera
Browse files

gif: Initialise code_last_byte to not cause undefined behaviour

Currently, code_last_byte is set only after it has been used, i.e.

    context->block_buf[0] = context->block_buf[context->code_last_byte - 2];

comes before anything has touched context->code_last_byte yet.
Except for the initialisation.
context->code_last_byte is set a few lines later, though.
And nowhere else, except for the initialisation which sets it
to 0.  That will inevitably lead to context->block_buf[-2] which is
undefined behaviour.

We hence set the code_last_byte to 2 in order to not make that
array index invalid.

https://bugzilla.gnome.org/show_bug.cgi?id=778584
parent ced897e6
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment