[doublecommander] Getting SIGSEGV during normal string concat operation at program startup.
Original Reporter info from Mantis: Cyrax
-
Reporter name:
Original Reporter info from Mantis: Cyrax
- Reporter name:
Description:
//#0 fpc_ansistr_concat(0x0, 0xdd92c0 'AddPoll ', 0x18cb6d0 '21', 0) at ../inc/astrings.inc:263 // local variables DESTS=0x0 S1='AddPoll ' S2='21' CP=0 S1LEN=8 S2LEN=281474976710658 SAME=3 S1CP=65001 S2CP=65001 DESTCP=65001
Somehow at this point, Length function gives string S2 wrong value. And further down the execution path, SetLength tries to allocate absurd amount memory for new string thus causing SIGSEGV to happen.
Additional information:
Project Double Commander raised exception class 'External: SIGSEGV'.
In file '../inc/astrings.inc' at line 779:
PAnsiRec(Pointer(S)-AnsiFirstOff)^.CodePage:=cp;
----
#0 fpc_ansistr_setlength(0x0, 281474976710666, 65001) at ../inc/astrings.inc:779 #1 fpc_ansistr_concat(0x0, 0xdd92c0 'AddPoll ', 0x18cb6d0 '21', 0) at ../inc/astrings.inc:280 #2 ADDPOLL(21, 1, {Proc = {procedure (POINTER, TOBJECT)} 0x7fffffffdda0, Self = 0x1b252a8}, false) at platform/unix/upollthread.pas:67 #3 TMONITOROBJECT__CREATE(0x1b252a8, 0x1) at platform/unix/linux/uudev.pas:604 #4 INITIALIZE at platform/unix/linux/uudev.pas:533 #5 TDRIVEWATCHER__INITIALIZE(0x10dc568, 21477072) at platform/udrivewatcher.pas:241 #6 TFRMMAIN__FORMCREATE(0x1a09828, 0x1a09828) at fmain.pas:1043 #7 TCUSTOMFORM__DOCREATE(0x1a09828) at include/customform.inc:939 #8 TCUSTOMFORM__AFTERCONSTRUCTION(0x1a09828) at include/customform.inc:149 #9 TFRMMAIN__AFTERCONSTRUCTION(0x1a09828) at fmain.pas:2646 #10 TFRMMAIN__CREATE(0x1a09828, 0xffffffffffffffff, 0x1407518) at fmain.pas:2641 #11 TAPPLICATION__CREATEFORM(0x1407518, 0xe6ed10, ) at include/application.inc:2241 #12 main at doublecmd.lpr:195 --- #0 fpc_ansistr_setlength(0x0, 281474976710666, 65001) at ../inc/astrings.inc:779 // local variables of fpc_ansistr_setlength S=0x0 L=281474976710666 CP=65001 TEMP=0x7fffffffdc60 LENS=19 LENA=140737488346196 MOVELEN=1 --- //#0 fpc_ansistr_concat(0x0, 0xdd92c0 'AddPoll ', 0x18cb6d0 '21', 0) at ../inc/astrings.inc:263 // local variables DESTS=0x0 S1='AddPoll ' S2='21' CP=0 S1LEN=8 S2LEN=281474976710658 SAME=3 S1CP=65001 S2CP=65001 DESTCP=65001 --- procedure Print(const sMessage: String); begin WriteLn('PollThread: ', sMessage); end; procedure AddPoll(fd: cint; events: cshort; handler: TNotifyEvent; //#1 ADDPOLL(21, 1, {Proc = {procedure (POINTER, TOBJECT)} 0x7fffffffdda0, Self = 0x1b252a8}, false) at platform/unix/upollthread.pas:67 CloseOnDestroy: Boolean); Var AString : String; begin EnterCriticalSection(Mutex); try if not Assigned(PollThread) then begin PollThread:= TPollThread.Create; end; PollThread.AddPoll(fd, events, handler, CloseOnDestroy); AString := IntToStr(fd); Print('AddPoll ' + AString); finally LeaveCriticalSection(Mutex); end; end; --- constructor TMonitorObject.Create; //#2 TMONITOROBJECT__CREATE(0x1b252a8, 0x1) at platform/unix/linux/uudev.pas:604 var fd: cint; begin // Get the file descriptor (fd) for the monitor // This fd will get passed to poll() fd := udev_monitor_get_fd(udev_monitor); AddPoll(fd, POLLIN, Handler, False); Print('Begin monitoring'); end;
Mantis conversion info:
- Mantis ID: 35639
- OS: Arch
- OS Build: 3.17.4-1
- Build: r42128
- Platform: Linux x86_64
- Version: 3.3.1