Sudden exception in acShellCtrls crashing program?

Viewing 11 posts - 21 through 31 (of 31 total)
  • Author
    Posts
  • #70999
    Lasse
    Participant

    Delphi 11.2 64-bit is crashing into “Stream read error” in System.Classes when skin manager tries to load skin from file. This has been working always. 32-bit build works fine… I’m not surprised at all.

    #71069
    Lar'c
    Participant

    I am on the same boat (64-bit AVs). I had to make a few changes to AlphaSkins but I am still wondering why this happens now. Is it Delphi 11.1 causing issues?

    My changes for AlphaSkins are:

    acgpUtils.pas:
    748:gpaPColor := Pointer(PAnsiChar{Integer}(bmData.Scan0) + Y * bmData.Stride);

    acShellCtrls.pas:
    4344: // InitSystemImageList;

    sGraphUtils.pas:
    7506: with PRGBQuad(PAnsiChar{Integer}(srcLine) + Pixel)^ do begin

    But after that I have issues with other 3rd party components and it is a huge swamp… I think I will install Delphi 11 and test if 11.1 update is causing these issues.

    Go to project options, then delphi compiler->Linking, turn off support high-enropy 64bit and you won’t get this error.

    #71070
    Lasse
    Participant

    Wow, thanks! This solved all issues with 64-bit build with Delphi 11.2. I read about this feature but never thought it would totally mess up everything.

    https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Support_high-entropy_64-bit_ASLR

    Sure, there still is the ZLib issue but it can be fixed.

    #71071
    Lar'c
    Participant

    Yes, thank you, I will use your zlib solution.

    #71072
    Lasse
    Participant

    I am currently using old version of ZLib but I tested that fix for current version of ZLib, suggested by wesson, and it did work too.

    “It can be solved in System.Zlib with the following (line 2752)”

    `if (zresult = Z_STREAM_END) and (FZStream.avail_in > 0) then
    begin
    Dec(FStreamPos, FZStream.avail_in);
    Fstream.Position := FStreamPos;

    FZStream.avail_in := 0;
    end;`

    #71073
    Lar'c
    Participant

    I prefer the solution of putting the new ZLibEx.pas in the alphaskins source directory, and declaring it in the modules sSkinManager.pas, acAlphaHints.pas, acPNG.pas, instead of acZLibEx

    #71074
    Lasse
    Participant

    That is a Windows feature… So, there must be some 64-bit math issues in AlphaSkins code which are causing it to fail.

    https://learn.microsoft.com/en-us/cpp/build/reference/highentropyva-support-64-bit-aslr?view=msvc-170

    #71075
    Lasse
    Participant

    I see there are a lot of Integer casts. All pointer or object references should be casted to NativeInt.

    #71085
    chris2023
    Participant

    Hi my System.zLib (Delphi 11 Update 2) looks so
    //

    function TZDecompressionStream.Read(var buffer; count: LongInt): LongInt;
    var
      zresult: Integer;
    begin
      FZStream.next_out := @buffer;
      FZStream.avail_out := count;
      zresult := Z_OK;
      while (FZStream.avail_out > 0) and (zresult <> Z_STREAM_END) and (zresult <> Z_BUF_ERROR) do
      begin
        if FZStream.avail_in = 0 then
        begin
          if FStream.Position <> FStreamPos then
            FStream.Position := FStreamPos;
          FZStream.avail_in := FStream.Read(FBuffer, length(FBuffer));
          Inc(FStreamPos, FZStream.avail_in);
    
          FZStream.next_in := @FBuffer[0];
    
          DoProgress;
        end;
    
        zresult := ZDecompressCheckWithoutBufferError(inflate(FZStream, Z_NO_FLUSH));
      end;
    
      Result := NativeUInt(count) - FZStream.avail_out;
    end;

    where must there place the line

    if (zresult = Z_STREAM_END) and (FZStream.avail_in > 0) then
    begin
    Dec(FStreamPos, FZStream.avail_in);
    Fstream.Position := FStreamPos;
    
    FZStream.avail_in := 0;
    end;

    ? by me its not line line 2752

    #71086
    Lasse
    Participant

    Embarcadero\Studio\22.0\source\rtl\common\System.ZLib.pas, Line 2850.

    You need your own fork for it.

    Attachments:
    You must be logged in to view attached files.
    #71144
    Support
    Keymaster

    Hello!
    The AlphaControls package v17 has been released today, the issue has been solved there.

Viewing 11 posts - 21 through 31 (of 31 total)
  • You must be logged in to reply to this topic.