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

Runtime Error: Invalid Memory Address or Nil Pointer Dereference #2968

Closed
4ndr0666 opened this issue Oct 15, 2023 · 5 comments
Closed

Runtime Error: Invalid Memory Address or Nil Pointer Dereference #2968

4ndr0666 opened this issue Oct 15, 2023 · 5 comments

Comments

@4ndr0666
Copy link

Issue Description
Summary
Micro encountered a runtime error related to an invalid memory address or nil pointer dereference.

Environment Information
Micro version: 2.0.12
Commit hash: c2cebaa
Compiled on: September 09, 2023
Operating System: Linux 6.5.7-arch1-1
Steps to Reproduce
Literally just opened a file.
Expected Behavior
I expected the file to open without any issues.

Actual Behavior
Micro crashed and provided the following stack trace:

Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:261 (0x55bd011e9818)
runtime/panic.go:260 (0x55bd011e97e6)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:403 (0x55bd0168b5cc)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:394 (0x55bd0168b3cc)
runtime/internal/atomic/types.go:194 (0x55bd011d50f2)
runtime/asm_amd64.s:1650 (0x55bd01206621)

@JoeKar
Copy link
Collaborator

JoeKar commented Oct 15, 2023

Let me guess:
You used the term command?
If yes, then it might be related to #2912 & #2964 or #2823.

@dmaluka
Copy link
Collaborator

dmaluka commented Oct 15, 2023

The crash was at this line:

	screen.Screen.Fill(' ', config.DefStyle)

Probably screen.Screen was nil.

Might be fixed by #2967.

@JoeKar
Copy link
Collaborator

JoeKar commented Oct 15, 2023

Yep, that's what I assumed too. Unfortunately...

Steps to Reproduce
Literally just opened a file.

...didn't really fit into that story.

@dmaluka
Copy link
Collaborator

dmaluka commented Oct 15, 2023

Perhaps some non-trivial things were happening when opening the file (some Lua code or whatever).

And I can't see any other places in the code where TempFini() may not be accompanied with subsequent TempStart().

Update: actually I do see one more such place now, also in overwriteFile():

		screenb = screen.TempFini()
		// need to start the process now, otherwise when we flush the file
		// contents to its stdin it might hang because the kernel's pipe size
		// is too small to handle the full file contents all at once
		if e := cmd.Start(); e != nil && err == nil {
			return err
		}

If cmd.Start() fails, the screen will remain shut down. Worth fixing too?

@dmaluka
Copy link
Collaborator

dmaluka commented Oct 15, 2023

I've just reproduced this crash: set sucmd option to aaa (a non-existing command instead of sudo) and try to save a file with escalated privileges.

Fix: #2971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants