Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when printing a file with percent sign in name #337

Open
the-ress opened this issue Feb 27, 2022 · 1 comment
Open

Crash when printing a file with percent sign in name #337

the-ress opened this issue Feb 27, 2022 · 1 comment
Labels
2.8 bug Features do not work properly

Comments

@the-ress
Copy link

Repro steps:

  1. Upload a file with percent signs in the filename (followed by anything other than 2 hex digits) - e.g. 20x_110%_110%_20mm_Ikea_Samla_Clip_45-65L_by_Wookbert_Rev._E3_0.6n_0.2mm_PETG_MK3S_6h23m.gcode
  2. In OctoScreen, tap Print
  3. Tap the uploaded file
  4. Confirm by tapping Yes

Expected result: The file starts printing.
Actual result: OctoScreen crashes and restarts. (Also the file thumbnail is missing in the file list. I assume it’s a related issue.)

Likely cause:

  1. In SelectFileRequest.go, the file name is joined into URI without escaping special characters resulting in an invalid URI.
  2. Then in client.go, the invalid URI is passed to url.Parse() which likely fails, but because the error is ignored, the application crashes 2 lines later with a nil pointer dereference.

Log:

Feb 28 00:14:29 prusheen xinit[3285]: time="2022-02-28T00:14:29+01:00" level=info msg="        Loading list of files from: local" file=logger.go func=logger.Infof line=150
Feb 28 00:14:34 prusheen xinit[3285]: time="2022-02-28T00:14:34+01:00" level=info msg="                Setting panel to \"FilesPanel\"" file=logger.go func=logger.Infof line=150
Feb 28 00:14:34 prusheen xinit[3285]: time="2022-02-28T00:14:34+01:00" level=info msg="                Background task closed" file=logger.go func=logger.Info line=146
Feb 28 00:14:39 prusheen xinit[3285]: time="2022-02-28T00:14:39+01:00" level=info msg="    Loading file \"20x_110%_110%_20mm_Ikea_Samla_Clip_45-65L_by_Wookbert_Rev._E3_0.6n_0.2mm_PETG_MK3S_6h23m.gcode\"" file=logger.go func=logger.Infof line=150
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() was called, now calling recover()
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - recover: runtime error: invalid memory address or nil pointer dereference
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [1] /usr/local/go/src/runtime/asm_arm.s, line 432
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [2] /usr/local/go/src/runtime/panic.go, line 491
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [3] /usr/local/go/src/runtime/panic.go, line 63
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [4] /usr/local/go/src/runtime/signal_unix.go, line 367
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [5] /usr/local/go/src/net/url/url.go, line 942
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [6] /go/src/github.com/Z-Bolt/OctoScreen/obj-arm-linux-gnueabihf/src/github.com/Z-Bolt/OctoScreen/octoprintApis/client.go, line 224
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [7] /go/src/github.com/Z-Bolt/OctoScreen/obj-arm-linux-gnueabihf/src/github.com/Z-Bolt/OctoScreen/octoprintApis/client.go, line 90
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [8] /go/src/github.com/Z-Bolt/OctoScreen/obj-arm-linux-gnueabihf/src/github.com/Z-Bolt/OctoScreen/octoprintApis/client.go, line 59
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() - [9] /go/src/github.com/Z-Bolt/OctoScreen/obj-arm-linux-gnueabihf/src/github.com/Z-Bolt/OctoScreen/octoprintApis/SelectFileRequest.go, line 38
Feb 28 00:14:39 prusheen xinit[3285]: 2022/02/28 00:14:39 main's defer() was called, now exiting func()
Feb 28 00:14:39 prusheen xinit[3285]: /usr/bin/xinit: connection to X server lost
Feb 28 00:14:39 prusheen xinit[3285]: [1B blob data]
Feb 28 00:14:39 prusheen xinit[3285]: waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
@JeffB42 JeffB42 added bug Features do not work properly 2.8 labels Mar 2, 2022
@JeffB42
Copy link
Collaborator

JeffB42 commented Mar 2, 2022

Hi, thanks for the great bug report (it is very clear and detailed). I'll get this fixed in the next release - 2.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.8 bug Features do not work properly
Projects
None yet
Development

No branches or pull requests

2 participants