RTC Forums
May 01, 2024, 11:31:31 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Potential Problem With Mime_EncodeEx in rtcInfo  (Read 3546 times)
Ryan
RTC Expired
*
Posts: 15


« on: February 23, 2014, 11:40:35 PM »

Hi Danijel,

RTC Version 6.29.

I've been experimenting with XML-RPC support in the RTC library today. I everything has been going well and I have my android tablet making XML requests to my RTC server. When I started returning datasets things started to go wrong. I began to get a pointer exception when a remote function was doing its clean up. I switched on MadExcept for my server project and included the memory overrun detection. When I did this the program would fail in MimeEncodeFullLines when executing the lines:

Code:
    OutPtr^.b1 := 13;
    OutPtr^.b2 := 10;
    OutPtr := PByte4(RtcIntPtr(OutPtr)+2);

The first line was the point the memory error triggered. Looking further I have determined that this error occurs if the input to Mime_EncodeEx is exactly 57 bytes in length. I've been looking at the output buffer size calculation

Code:
        aSize := (l + 2) div 3 * 4 + (l - 1) div MIME_DECODED_LINE_BREAK * 2

and I'm wondering if doing this as an integer division is the problem? If l is 57 then the formula gives an output buffer size of 76. The buffer needs to be 78 bytes to contain the two additional CR LF characters MimeEncodeFullLines wants to add. Using a calculator and keeping all of the decimal points though the calculation I get and 80 byte buffer if I round down at the end.

I'm not sure if the formula needs to be altered or if MimeEncodeFullLines needs a small modification to stop the CR LF characters being added if the buffer is 57 bytes long.

Many thanks for any advice.
Ryan

p.s. I'm not using Delphi XE5 as there are up and coming Android devices which are not currently supported by the Delphi complier.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 24, 2014, 01:12:27 PM »

Thank you for reporting this issue.

The problem was in the MimeEncodeFullLines function, which was adding a CRLF at the end of the last line, even if there were no characters behind it. I've fixed the problem now and released an update. Please, download RTC SDK v6.30 and let me know if you have any other problems.

Best Regards,
Danijel Tkalcec
Logged
Ryan
RTC Expired
*
Posts: 15


« Reply #2 on: February 28, 2014, 10:57:53 PM »

Hi Danijel,

Many thanks for the fix. I've downloaded it and it all works well.

Take care,
Ryan
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: February 28, 2014, 11:13:17 PM »

Thank you for the feedback.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.