Hello.
I'm just tried to convert our application which uses MIME decoder from OverbyteIcsMimeDec.pas
Under Ubuntu I'm got Access Violation (Segmentation fault/Invalid address) in function IcsMbToWc while decoding simple EML file.
Problem reproduced by sample code (see below).
Sysinfo:
Delphi 11.3 (28.0.47991.2819)
ICS: v8.70 release
Ubunt: 22.04.2 LTS
Test code:
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, OverbyteIcsUtils;
var
TestStr: RawByteString;
ResStr: string;
begin
TestStr := 'This is an OpenPGP/MIME signed message (RFC 4880 and 3156)';
ResStr := AnsiToUnicode(TestStr, CP_UTF8);
end.
Stacktrace (Delphi does not show any stacktrace, so this trace from lldb debugger):
* thread #1, name = 'Project1', stop reason = signal SIGSEGV: invalid address (fault address: 0x7ffffffff000)
* frame #0: 0x00007ffff7fb16db UTF-16.so`gconv at loop.c:335:7
frame #1: 0x00007ffff7fb16d0 UTF-16.so`gconv(step=0x00000000007354d8, data=0x0000000000745d10, inptrp=0x00007fffffffe0a8, inend="", outbufstart=0x0000000000000000, irreversible=0x00007fffffffe170, do_flush=0, consume_incomplete=0) at skeleton.c:623:12
frame #2: 0x00007ffff7d991c2 libc.so.6`__gconv_transform_utf8_internal(step=0x0000000000735470, data=0x0000000000745ce0, inptrp=0x00007fffffffe2f8, inend="", outbufstart=0x0000000000000000, irreversible=0x00007fffffffe170, do_flush=0, consume_incomplete=0) at skeleton.c:675:17
frame #3: 0x00007ffff7d92a9f libc.so.6`__gconv(cd=0x0000000000745cd0, inbuf=0x00007fffffffe2f8, inbufend="", outbuf=0x00007fffffffe2f0, outbufend=<unavailable>, irreversible=0x00007fffffffe170) at gconv.c:77:13
frame #4: 0x00007ffff7d9238b libc.so.6`iconv(cd=<unavailable>, inbuf=0x00007fffffffe2f8, inbytesleft=0x00007fffffffe304, outbuf=0x00007fffffffe2f0, outbytesleft=0x00007fffffffe308) at iconv.c:51:16
frame #5: 0x00000000005a5dd2 Project1`Overbyteicsutils::IcsMbToWc(CodePage=0, Flags=0, MbStr=0x0000000000000000, MbStrLen=0, WStr=Summary Unavailable, WStrLen=0) at OverbyteIcsUtils.pas:2164:1