[Issue 14692] SIGSEGV during SHA.put

2022-02-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

Mathias LANG  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |INVALID

--- Comment #8 from Mathias LANG  ---
Looking into this, I noticed the code is triggered from a module constructor:
> #14 0x007687f5 in db.mysql_test() () at source/db.d:17
> #15 0x006f525e in app._sharedStaticCtor1() () at source/app.d:16
> #16 0x00768799 in app.__modsharedctor() ()

The report doesn't mention what version of DMD is being used, but according to
the time of the report, I assume circa 2.068, in which case the line
segfaulting would be
https://github.com/dlang/phobos/blob/v2.068.0/std/digest/sha.d#L723
The stack trace seems to match, and since SHA doesn't change much, I'm pretty
confident this is correct.

The jump to 0x00[...]00 seems to indicate that `transform` is `null`.
Looking into the module, there is indeed a case where it could be `null`: If
`digestSize == 160`, `version = USE_SSSE3`, and the module constructor of your
application was to run before SHA's module ctor
(https://github.com/dlang/phobos/blob/v2.068.0/std/digest/sha.d#L216-L231).

`version = SSSE3` is true on amd64
(https://github.com/dlang/phobos/blob/b82986e64fbb2950af118f4711e1558a4134c803/std/digest/sha.d#L118-L121),
and the first line indicates that `digestSize == 160`:
> #1  0x00712eea in std.digest.sha.SHA!(512, 160).SHA.put(scope 
> const(ubyte)[]...) (this=0x7fffd160, input=...) at 
> /usr/include/dmd/phobos/std/digest/sha.d:723

Based on this, I am going to assume the missing piece (order of module ctor) is
indeed the issue. It would also explain why a different version of the
compiler/runtime and a different backend would work (different order of ctor
running).

Hence, the best way forward to fix this issue is to move your code to the
`main`, so that all modules ctor have a chance to run.

--


[Issue 14692] SIGSEGV during SHA.put

2020-08-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

Walter Bright  changed:

   What|Removed |Added

   Keywords||backend
 CC||bugzi...@digitalmars.com

--


[Issue 14692] SIGSEGV during SHA.put

2015-08-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

--- Comment #7 from Vladimir Panteleev  ---
We're going to need a self-contained reproducible testcase. Please check out
Dustmite if you haven't already.

Since this problem doesn't manifest in GDC, your Dustmite test script can try
compiling the program with GDC and DMD, and return 0 only if the program
segfaults with DMD but not GDC.

--


[Issue 14692] SIGSEGV during SHA.put

2015-08-07 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

--- Comment #6 from Rory rjmcgu...@gmail.com ---
More brain dump stuff, because I've run out of time looking at this for now:

From what I can tell it appears that transform() is invalid in DMD and LDC.
I do not have this problem in GDC which has an outdated frontend.

This is the code at #2  0x00713072 in std.digest.sha.SHA!(512,
160).SHA.finish() (this=0x7fffd160, __HID34=0x7fffd1d0) at
/usr/include/dmd/phobos/std/digest/sha.d:768

 transform (state, buffer);

Seems it calls into no where.

transform is supposed to be setup in line 235:
alias transform = transformSHA2!ulong;

--


[Issue 14692] SIGSEGV during SHA.put

2015-07-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

--- Comment #5 from Rory rjmcgu...@gmail.com ---
This is still an issue in dmd.2.068.0-b2.linux.zip

0x in ?? ()
(gdb) bt
#0  0x in ?? ()
#1  0x0074f117 in std.digest.sha.SHA!(512, 160).SHA.put(scope
const(ubyte)[]...) (this=..., input=...) at
/usr/include/dmd/phobos/std/digest/sha.d:723
#2  0x0074f2b6 in std.digest.sha.SHA!(512, 160).SHA.finish() (
this=..., __HID3=0x7fffd190)
at /usr/include/dmd/phobos/std/digest/sha.d:768
#3  0x00778275 in std.digest.digest.digest!(std.digest.sha.SHA!(512,
160).SHA, const(ubyte)[]).digest(scope const(ubyte[])) (__HID62=0x7fffd1e8, 
_param_0=...) at /usr/include/dmd/phobos/std/digest/digest.d:435
#4  0x007781ed in
std.digest.sha.sha1Of!(const(ubyte)[]).sha1Of(const(ubyte)[])
(__HID61=0x7fffd410, _param_0=...)
at /usr/include/dmd/phobos/std/digest/sha.d:1102
#5  0x007a1c1a in
mysql.connection.Connection!(mysql.socket.VibeSocket).Connection.eatHandshake(mysql.packet.InputPacket)
(this=..., packet=...)
at
../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/connection.d:471
#6  0x007a14e5 in
mysql.connection.Connection!(mysql.socket.VibeSocket).Connection.connect()
(this=...)
at
../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/connection.d:336
#7  0x007a06ee in
mysql.connection.Connection!(mysql.socket.VibeSocket).Connection.connect(immutable(char)[])
(this=..., connectionString=...)
at
../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/connection.d---Type
return to continue, or q return to quit---
:77
#8  0x007a036b in
mysql.client.MySQLClientT!(mysql.socket.VibeSocket).MySQLClientT.this(immutable(char)[]).__lambda2()
(this=0x77ec2900)
at ../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/client.d:13
#9  0x007a3802 in
vibe.core.connectionpool.ConnectionPool!(mysql.connection.Connection!(mysql.socket.VibeSocket).Connection*).ConnectionPool.lockConnection()
(this=0x77ec3700, __HID128=0x7fffd8d8)
at
../../../../../../.dub/packages/vibe-d-0.7.24-rc.1/source/vibe/core/connectionpool.d:54
#10 0x007a0612 in
mysql.client.MySQLClientT!(mysql.socket.VibeSocket).MySQLClientT.lockConnection()
(this=0x77ec28a0, __HID126=0x7fffd8d8)
at ../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/client.d:31
#11 0x007a023d in
mysql.client.MySQLClientT!(mysql.socket.VibeSocket).MySQLClientT.this(immutable(char)[])
(this=0x77ec28a0, connectionString=...)
at ../../../../../../.dub/packages/mysql-lited-0.2.14/src/mysql/client.d:17
#12 0x0078de22 in db._sharedStaticCtor6() () at source/db.d:13
#13 0x0081f8d1 in db.__modsharedctor() ()
#14 0x009b1200 in
_D2rt5minfo67__T14runModuleFuncsS442rt5minfo11ModuleGroup8runCtorsMFZ9__lambda2Z14runModuleFuncsMFAxPyS6object10ModuleInfoZv
()
#15 0x009b0f45 in rt.minfo.ModuleGroup.runCtors() ()
#16 0x0096c5c9 in rt.minfo.rt_moduleCtor().__foreachbody1(ref
rt.sections_elf_shared.DSO) ()
#17 0x0096cafd in rt.sections_elf_shared.DSO.opApply(scope int(ref
rt.se---Type return to continue, or q return to quit---
ctions_elf_shared.DSO) delegate) ()
#18 0x0096c597 in rt_moduleCtor ()
#19 0x0096828c in rt_init ()
#20 0x0096865e in rt.dmain2._d_run_main(int, char**, extern(C)
int(char[][]) function*).runAll() ()
#21 0x0096861a in rt.dmain2._d_run_main(int, char**, extern(C)
int(char[][]) function*).tryExec(scope void() delegate) ()
#22 0x0096859a in _d_run_main ()
#23 0x008218f0 in main ()
#24 0x76873a40 in __libc_start_main (main=0x8218d0 main, argc=1, 
argv=0x7fffdd88, init=optimized out, fini=optimized out, 
rtld_fini=optimized out, stack_end=0x7fffdd78) at libc-start.c:289
#25 0x0074c529 in _start ()
(gdb)

--


[Issue 14692] SIGSEGV during SHA.put

2015-06-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

--- Comment #3 from Rory rjmcgu...@gmail.com ---
(In reply to Vladimir Panteleev from comment #2)
 Issue 9279 ?

Perhaps it is, how could I check that? Why would the code work fine in GDC
then?

--


[Issue 14692] SIGSEGV during SHA.put

2015-06-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

--- Comment #4 from Vladimir Panteleev thecybersha...@gmail.com ---
(In reply to Rory from comment #3)
 Perhaps it is, how could I check that?

Try D from git master.

 Why would the code work fine in GDC then?

Why wouldn't (or would) it?

--


[Issue 14692] SIGSEGV during SHA.put

2015-06-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

Vladimir Panteleev thecybersha...@gmail.com changed:

   What|Removed |Added

 CC||thecybersha...@gmail.com

--- Comment #2 from Vladimir Panteleev thecybersha...@gmail.com ---
Issue 9279 ?

--


[Issue 14692] SIGSEGV during SHA.put

2015-06-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14692

Rory rjmcgu...@gmail.com changed:

   What|Removed |Added

   Keywords||wrong-code
   Severity|blocker |major

--- Comment #1 from Rory rjmcgu...@gmail.com ---
I'm guessing its wrong code if its crashing in DMD and not GDC.

--