Graphics32 AV in TCustomBitmap32.LineAS

Issue #165 new
rgreat
created an issue

GR32.pas line 4829 cause AV due to (D1^ + D2^ * Width + PI) being out of bitmap memory,

        P := @Bits[D1^ + D2^ * Width];
        BlendMemEx(Value, P^, GAMMA_TABLE[CI xor $FF]);
        Inc(P, PI);
        BlendMemEx(Value, P^, GAMMA_TABLE[CI]);  <---

Comments (1)

  1. rgreat reporter

    Possible fix:

      n,nm: integer;
    
    <..>
        nm:=Width*Height;
    <..>
            n:=D1^ + D2^ * Width;
            P := @Bits[n];
            BlendMemEx(Value, P^, GAMMA_TABLE[CI xor $FF]);
            Inc(P, PI);
            if (n+PI>=0) and (n+PI<nm) then begin
              BlendMemEx(Value, P^, GAMMA_TABLE[CI]);    
            end;
    
  2. Log in to comment