#1 Re: PDF Engine » Bug in SynPDF.pas » 2012-09-25 13:47:27

In TPdfWrite.AddHex is similar bug, there must be:

...
    if B+L*2>=Bend then begin
...

b.

#2 PDF Engine » Bug in SynPDF.pas » 2012-09-25 13:30:13

blabulabul
Replies: 2

Hi,

function TPdfWrite.AddUnicodeHex in SynPDF.pas rewrites memory and causes crashes. Here is a fix:

...
begin
  repeat
    L := WideCharCount;
    if B+L*4>=Bend then begin
      Save;
      if L*4>high(Tmp) then
        L := high(Tmp) shr 2; // max WideCharCount allowed in Tmp[]
    end;
    BinToHex4(pointer(PW),B,L);
    inc(PtrInt(PW),L*2);
    inc(B,L*4);
    dec(WideCharCount,L);
  until WideCharCount=0;
  result := self;
end;


blabulabul

Board footer

Powered by FluxBB