Title: Potential Problem With Mime_EncodeEx in rtcInfo Post by: Ryan 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; 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. Title: Re: Potential Problem With Mime_EncodeEx in rtcInfo Post by: D.Tkalcec (RTC) 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 Title: Re: Potential Problem With Mime_EncodeEx in rtcInfo Post by: Ryan 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 Title: Re: Potential Problem With Mime_EncodeEx in rtcInfo Post by: D.Tkalcec (RTC) on February 28, 2014, 11:13:17 PM Thank you for the feedback.
Best Regards, Danijel Tkalcec |