Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Bug fix - If you have 18.11 source code.
  FAQ FAQ  Forum Search   Register Register  Login Login

Bug fix - If you have 18.11 source code.

 Post Reply Post Reply
Author
Message
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post Topic: Bug fix - If you have 18.11 source code.
    Posted: 16 Apr 25 at 10:43PM
unit DebenuPDFLibraryFontRasterizer has a bug that can cause an infinite loop when rendering some PDFs
I DO NOT KNOW IF THIS IS THE EXTACT RIGHT THING TO DO!!! However, it fixed a problem I was having with a very small number of documents, and I know it does nothing that would break the vast majority that were already working. 

I have solved it in my library by adding an else/break condition in the function GetW2DictCount:

  function GetW2DictCount: Integer;
  begin
    Result := 0;
    Obj := Font.FindValueByKeyName('W2', True);
    if (Obj is TPDFArray) and (TPDFArray(Obj).Count > 1) then
    begin
      WArray := TPDFArray(Obj);
      WX := 0;
      while WX < (WArray.Count - 1) do
      begin
        if WArray.Item[WX] is TPDFNumeric then
        begin
          if WArray.Item[WX + 1] is TPDFNumeric then
          begin
            WX := WX + 5;
            Inc(Result);
          end
          else if WArray.Item[WX + 1] is TPDFArray then
          begin
            Inc(Result, TPDFArray(WArray.Item[WX + 1]).Count);
            Inc(WX, 2);
          end
          // -------------------
          // swb 4-16-2025 if WX is never inc'd it will loop infinitely.
          else
          begin
            break;
          end;
          // -------------------
        end
        else if WArray.Item[WX + 1] is TPDFArray then
        begin
          Inc(Result, TPDFArray(WArray.Item[WX + 1]).Count div 3);
          Inc(WX, 2);
        end;
      end;
    end;
  end;
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store