CTFd: serve.py crashes without any errors on Windows
Environment:
- CTFd Version/Commit: https://github.com/CTFd/CTFd/commit/d23f59dbd51925aac1aa6294c934d701953075d0
- Operating System: Windows 10, python 3.9.2
- Web Browser and Version: n/a
What happened? Some errors from pybluemonday go code upon starting, see stacktrace below.
I reverted to the commit before pybluemonday was implemented https://github.com/CTFd/CTFd/commit/8de9819bd45be7483f252d37d0d0a2977dd7bd6d and it was able to start normally.
What did you expect to happen? No errors and CTFd starts normally.
How to reproduce your issue
- Install pip dependencies
pip install -r requirements.txt - Start with
python serve.py
Any associated stack traces or error logs
PS C:\Users\Ben10\Documents\GitHub\CTFd> python serve.py
* Importing gevent and monkey patching. Use --disable-gevent to disable.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x6d2efafd]
goroutine 17 [running, locked to thread]:
github.com/microcosm-cc/bluemonday.(*Policy).init(...)
C:/Users/RUNNER~1/AppData/Local/Temp/tmp4rqegntm/src/github.com/microcosm-cc/bluemonday/policy.go:173
github.com/microcosm-cc/bluemonday.(*Policy).AllowElements(0x0, 0xc0002b00e0, 0x1, 0x1, 0x0)
C:/Users/RUNNER~1/AppData/Local/Temp/tmp4rqegntm/src/github.com/microcosm-cc/bluemonday/policy.go:488 +0x2d
reflect.Value.call(0x6d361b00, 0x0, 0x1613, 0x6d36825e, 0x4, 0xc000279e40, 0x1, 0x1, 0x6d3a4240, 0xc000064f60, ...)
C:/hostedtoolcache/windows/go/1.14.12/x64/src/reflect/value.go:460 +0x8b2
reflect.Value.Call(0x6d361b00, 0x0, 0x1613, 0xc000279e40, 0x1, 0x1, 0x0, 0x1613, 0xc000279e80)
C:/hostedtoolcache/windows/go/1.14.12/x64/src/reflect/value.go:321 +0xbb
main.CallPolicyFunctionWithString(0xc007fcfd52, 0x1e2469cabf0, 0x1e2469cac80)
C:/Users/RUNNER~1/AppData/Local/Temp/tmp4rqegntm/src/github.com/ColdHeat/pybluemonday/bluemonday.go:145 +0x23c
main._cgoexpwrap_8294da18a757_CallPolicyFunctionWithString(0x1e207fcfd52, 0x1e2469cabf0, 0x1e2469cac80)
_cgo_gotypes.go:163 +0x44
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 17 (16 by maintainers)
After digging through this for awhile, can you try running
flask runinstead ofserve.py?The latest pybluemonday wheels work just fine on Windows but I think something about flask run works better on Windows. Technically it’s the recommended approach for dev servers according to the Flask docs anyway. https://flask.palletsprojects.com/en/1.1.x/server/