[haiku-commits] Re: haiku: hrev49620 - src/kits/interface src/servers/app headers/private/interface

  • From: marcus overhagen <marcusoverhagen@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 7 Sep 2015 12:29:05 +0200

On Sat, Sep 5, 2015 at 4:11 PM, <mmlr@xxxxxxxx> wrote:

case B_PIC_SET_STIPLE_PATTERN:
{
+ const pattern* stipplePattern;
+ if (callbacks.set_stipple_pattern == NULL
+ || !reader.Get(stipplePattern)) {
+ break;
+ }
+
+ callbacks.set_stipple_pattern(userData,
*stipplePattern);
break;
}

Although it is save, playback of the picture is completely aborted as
soon as any of the callbacks is zero,
because the parameters won't be read and any further data that is read is wrong.
I would change this to always get the parameters first, and then test
for callback availablity.

if (!reader.Get(stipplePattern))
break;
if (callbacks.set_stipple_pattern == NULL)
break;

regards
Marcus

Other related posts: