Jump to content

Marcelo Jaloto

Members
  • Content Count

    14
  • Joined

  • Last visited

Posts posted by Marcelo Jaloto


  1. It is important to understand what has been documented here. For future similar problems you can use this as a lesson learned. I understand that the problem is hard to find and I also understand about dynamic array, but thanks for the readability indicated. The fact that your solution also worked does not mean that it is the only acceptable solution and that I cannot question some other factors. What it seems to me is that there are other related issues compiling with 64 bits.
    And most important of all is we are working as a team and solving the problems that are coming up.


  2. @Angus Robertson

    Could you review the @kas solution? And add it in the next version?


    Remember that in version 8.64 there are still other problems that may be solved with this same solution.


    In the OverbyteIcsSslWebServ example I noticed that I didn't have the Win64 platform added to the project. IOS Device 64bits only and Win 32bits.

    I don't understand why you couldn't reproduce the problem if it happens to me so easily without any of the solutions. Maybe you have different DLLs from my other required file?


  3. @Kas Ob.

    The problem can be reproduced by following @Angus Robertson instructions with the example OverbyteIcsSslWebServ.
    I suggest going back to version 8.63 to resolve this issue and only then moving on to version 8.64 because you have several other Access Violation issues.

     

    You may not have seen it in one of my posts regarding parameter values.

     

    The Len parameter comes with the value 12.

    The first 12 characters in ordinal form in the Buffer parameter byte array are:

    2-104-50-8-104-116-116-112-47-49-46-49

    ignore the "-" above. just for ease of understanding.

    This is equivalent to "2h28http / 1.1"

     

    The result in SList is:
    h2
    http / 1.1

     

    @FPiette 

    here we use madException. All my tests were done with madException.


  4. @Angus Robertson

     

    I installed version 8.64 which was on SVN as recommended and the access violation error keeps happening in the same location.


    image.thumb.png.c806368f288d4343379dacc618ed350e.png 

     

    Adding the code lines of my solution and its changes the problem no longer occurs in the IcsWireFmtToStrList method and same result is obtained in 32 and 64 bits.

     

    However in other locations other new Access Violation issues occur using 64-bit using version 8.64 that were not occurring in version 8.63. I don't know what caused them after their changes.

     

    After that I followed his instructions on OverbyteIcsSslWebServ sample using version 8.64. And there are also Access Violation issues when loading demo.html.

     

    So as my last solution was not accepted I went back to my first palliative solution by forcing the decision to http / 1.1 and commenting on the calls to IcsWireFmtToStrList in the AlpnSelectCallBack method as first post and back to version 8.63.

     

    I will wait for a definitive 64bits solution of yours that will work with HTTPS support.


  5. Now that it is known where the error is and the parameter values as infomated in my post just isolate the IcsWireFmtToStrList function and do all the necessary 32 and 64 bit tests. In all my tests the problem of Access Violation has been resolved.

     

    Another suggestion is to make other code that does not use pointers that results in the same value to work in 32 and 64 bits. However if you want to continue using the Move function you need the number of bytes a pointer occupies in memory.
    This was suggested by Embarcadero as a solution proposal.


  6. The Buffer parameter of type TBytes gets a pointer to a byte array and it must be understood that at 32 bits a pointer is 4 bytes and at 64 bits it is 8 bytes. When you use the Move function you are making a direct copy of memory that needs to take into account how many bytes each position has based on the number of bits. Maybe try another solution that doesn't use the Move function. All places that have the Move function need to be re-validated. And also all places where some kind of pointer calculation is being worked on because for 64bit it needs to be re-validated as Embarcadero recommends.

     

    Please read the article below.
    http://docwiki.embarcadero.com/RADStudio/Rio/en/Converting_32-bit_Delphi_Applications_to_64-bit_Windows

     

    @Kas Ob.

    Exactly. With 32bits must be considered 4 bytes and with 64 bits must be considered 8 bytes.


  7. Hello
    I discovered the bug and the solution.


    A pointer is 4 bytes in 32 bits and 8 bytes in 64 bits.

     

    See more at :
    http://docwiki.embarcadero.com/RADStudio/Rio/en/Converting_32-bit_Delphi_Applications_to_64-bit_Windows

     

    The IcsWireFmtToStrList method of the OverbyteIcsUtils unit had a problem moving characters with Move without regard to the number of bytes.

     

    Wrong:

    Move (Buffer [offset], AStr [1], mylen);

     

    Correct:

    Move (Buffer [offset], AStr [1], mylen * SizeOf (TBytes));

     

    The Len parameter comes with the value 12.

     

    The first 12 characters in ordinal form in the Buffer parameter byte array are:

    (2) 104 50 (8) 104 116 116 112 47 49 46 49

    This is equivalent to "2h28http/1.1"

    The numbers in parentheses delimit the end of the copy.

     

    See the code running and running at 32 and 64 bits.

     

    image.thumb.png.8b5af36b84725a1d5bcb0aeb94241164.png

     

     

    @Angus Robertson

    Can you add this correction / contribution to your source code?

     

    Many thanks to all who participated in this case.


  8. Hi Angus Sorry for my absence in the answers for a few days. I returned to this case to update Overbyte ICS with its fixes.

    The link below does not contain your modifications.
    http://wiki.overbyte.eu/wiki/index.php/ICS_Download

    Before reporting the issue I had already updated to November 8.63, 2019.

    Where are the new updates with the fix for this case?

    Could you pass the correct link? Or update the link above?

    Thank you!


  9. This code did not resolve.

    function IcsStrListToWireFmt(SList: TStrings; var Buffer: TBytes): Integer;
    ..
            //if mylen > 0 then begin		
            if (mylen > 0) or (mylen <= 255) then begin   // legal length

     

    This code did not resolve.

    function IcsWireFmtToStrList(Buffer: TBytes; Len: Integer; SList: TStrings): Integer;
    ...
            //if mylen = 0 then Exit;  // illegal
            if (mylen = 0) or (mylen + offset >= Len) then Exit;  // illegal

     

    workaround:

    I commented on some unimportant things for the moment and it worked like this according to the code below.

     

     image.thumb.png.170911e8a89ac90bd385012ee15eeb60.png

     

    The problem is in this call using 64bits. Within the IcsWireFmtToStrList Method.

    Count := IcsWireFmtToStrList(TBytes(input), inlen, ProtoList);

     


  10. Thanks for the replies guys.

     

    This code is not my own, but I am trying to fix the bug that is occurring. 

     

    Regarding ALPN there is the code below which may be influencing perhaps. Is this code below necessary? Is it ok?

    procedure THttpServer.OnSslAlpnSelect(Sender: TObject; ProtoList: TStrings;
      var SelProto: string; var ErrCode: TTlsExtError);
    var
      vCount: Integer;
    begin
      if ProtoList.Count = 0 then
        Exit;
    
      for vCount := 0 to ProtoList.Count - 1 do
      begin
        if ProtoList[vCount] = ALPN_ID_HTTP11 then
        begin
          SelProto := ALPN_ID_HTTP11;
          ErrCode := teeOk;
          Exit;
        end;
      end;
    end;

    // ALPN_ID_HTTP11        = 'http/1.1';

     

    The parameter ProtoList.Text has the content below:

    h2
    http/1.1

     

    Compiling in 32bits works normally. We are enabling SSL (https) support for our product and are reporting it with 64bits.

     

    Is there a 64bit problem in ICS overbyte related to the IcsWireFmtToStrList method and the ALPN event.

     

     


  11. Can someone help me?
     
    We are having a bug (access violation) with SSL (HTTPS support) only in 64bits. 
     
    My current Overbyte ICS version is 8.63.
     
    The bug is attached image.
     
     
    {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
    { V8.57 convert wire-format concactanted length prefixed strings to TStrings }
    function IcsWireFmtToStrList(Buffer: TBytes; Len: Integer; SList: TStrings): Integer;
    var
        offset, mylen: integer;
        AStr: AnsiString;
    begin
        Result := 0;
        if NOT Assigned(SList) then Exit;
        SList.Clear;
        offset := 0;
        while offset < Len do begin
            mylen := Buffer[offset];
            if mylen = 0 then Exit;  // illegal
            offset := offset + 1;
            SetLength(AStr, mylen);
            Move(Buffer[offset], AStr[1], mylen);
            SList.Add(String(AStr));
            offset := offset + mylen;
        end;
        Result := Slist.Count;
    end;

     

     

    16-12-2019 21-29-52.jpg

    16-12-2019 21-28-07.jpg

×