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

Crashes when truncating metadata #50

Closed
AnshumanNeon opened this issue Apr 11, 2024 · 9 comments
Closed

Crashes when truncating metadata #50

AnshumanNeon opened this issue Apr 11, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@AnshumanNeon
Copy link
Contributor

Describe the bug
I try to move my cursor to a file but spf crashes when I do so. The crash logs tell that this happens when we try to truncate the text, i.e. spf tries to get metadata and because it cannot fit in metadata panel, it tries to truncate it. Then it crashes. The exact line mentioned is in file components/style.go and line 234.
I will try to work on this to find why this is happening.

To Reproduce
Steps to reproduce the behavior:

  1. open superfile config folder in spf
  2. Move cursor to the log file
  3. See error

Expected behavior
Nothing should've happened. (At least the crash shouldn't have happened)

Screenshots
Screenshot 2024-04-11 at 3 55 36 PM

System information (please complete the following information):

  • OS: MacOS
  • Version: 10.15.7
@AnshumanNeon AnshumanNeon added the bug Something isn't working label Apr 11, 2024
@yorukot
Copy link
Owner

yorukot commented Apr 11, 2024

@AnshumanNeon
Copy link
Contributor Author

Screenshot 2024-04-12 at 2 46 24 PM
is the line what the function call looks like?
because if it is, then it is bad. the interger value is will cause a wrap around. It is a 20-digit number. I doubt it can be represented by golang.

@yorukot
Copy link
Owner

yorukot commented Apr 12, 2024

Is it a problem with maxChars? How about we change it to int64.

Or i miss something

@AnshumanNeon
Copy link
Contributor Author

int64 can have at max 19-digit It won't do any good. The problem is that how can such a high number be passed as an argument. I don't understand

@yorukot
Copy link
Owner

yorukot commented Apr 12, 2024

i find this error in a random file
This is metadata
https://gist.github.com/MHNightCat/75b5d3ebe82e60636fc6e3c62d2774b1

@yorukot
Copy link
Owner

yorukot commented Apr 12, 2024

Okay, I figured out the cause of this error.

So there is a metadata name called
NetHttp_Server_PropertiesServersAlternative_ServiceAdvertised_Alpns
Then in order to calculate the remaining length, this method is used to calculate
(BottomWidth(m.fullWidth))-maxKeyLength-3
and the result is -2
That why error i think

@yorukot
Copy link
Owner

yorukot commented Apr 12, 2024

Ok i fix it in here

@AnshumanNeon
Copy link
Contributor Author

oh! thank you so much! Let me just test this real quick

@AnshumanNeon
Copy link
Contributor Author

Yeah it works nice now! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants