bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

Segfault on crypto.mod import #571

Closed GWRon closed 2 years ago

GWRon commented 2 years ago

@Scaremonger mentioned on discord, that the following code leads to a segfault.

SuperStrict
Import crypto.digest

indeed it makes BCC segfault ... When debugging BCC and going down the rabbit hole a bit it leads to a null access after trying to find a class with "_env" being null...

image image image

Scaremonger commented 2 years ago

Adding framework above it stops the segment fault:

SuperStrict
Framework brl.retro
Import Crypto.MD5digest

So I concluded there was a conflict with an automatically imported module and I put the following code together to track it down. It seems to be brl.gnet!

SuperStrict

Framework brl.appstub
Import brl.eventqueue
Import brl.maxlua
Import brl.standardio
Import brl.audio
Import brl.filesystem
Import brl.maxunit
Import brl.stbimageloader
Import brl.audiosample
Import brl.font
Import brl.maxutil
Import brl.stream
Import brl.bank
Import brl.freeaudioaudio
Import brl.objectlist
Import brl.stringbuilder
Import brl.bankstream
Import brl.freetypefont
Import brl.oggloader
Import brl.systemdefault
Import brl.base64
Import brl.GLGraphics
Import brl.openalaudio
Import brl.system
Import brl.basic
Import brl.glmax2d
Import brl.pixmap
Import brl.textstream
Import brl.blitz
'Import brl.gnet
Import brl.platform
Import brl.tgaloader
Import brl.bmploader
Import brl.Graphics
Import brl.pngloader
Import brl.threadpool
Import brl.bytebuffer
Import brl.hook
Import brl.polledinput
Import brl.threads
Import brl.clipboard
Import brl.httpstream
Import brl.quaternion
Import brl.timerdefault
Import brl.collections
Import brl.io
Import brl.ramstream
Import brl.timer
Import brl.color
Import brl.jpgloader
Import brl.randomdefault
Import brl.uuid
Import brl.d3d7max2d
Import brl.keycodes
Import brl.random
Import brl.vector
Import brl.d3d9max2d
Import brl.linkedlist
Import brl.volumes
Import brl.directsoundaudio
Import brl.map
Import brl.reflection
Import brl.wavloader
Import brl.dxgraphics
Import brl.math
Import brl.retro
Import brl.endianstream
Import brl.matrix
Import brl.socket
Import brl.event
Import brl.max2d
Import brl.socketstream

Import Crypto.MD5digest
GWRon commented 2 years ago

In Brl.Gnet/gnet.bmx there is this line

Field _enetEvents:TArrayList<EnetEvent> = New TArrayList<EnetEvent>

I removed all occourencies of "_enetEvents" (field and usage in code - ignoring that it breaks functionality) and then it compiles again without segfaulting

GWRon commented 2 years ago

your fix makes the module "useable" now (in the way "requested" by scaremonger) - but the underlaying bug (the broken generics array list usage) is still valid - or not?

In that case this issue should be reopened.