Fixing errors on Linkshell/Linkpearls/Pearlsacks#2001
Merged
z16 merged 3 commits intoWindower:devfrom Feb 13, 2021
Merged
Conversation
This change fixes two errors that happen when Linkshells with certain combinations of characters result in a bitpacked LS name that contains zeroed bytes in the middle. First change detects the length of the name properly, second change fixes the `nil` error.
Contributor
Author
|
A better/more elegant/leaner way of doing it is welcome. This was the most basic way I could come up with. |
Member
If you're sure there is at least one non-null byte (which makes sense, I think? Considering it's only parsed in case of an LS name) you can do this: local name_end = #str
while str:byte(name_end) == 0 do
name_end = name_end - 1
endIf you want to make sure it's at least 10 you can add |
Contributor
Author
|
I famously forget that |
Contributor
Author
|
Done. I put the > 10 in, should never actually be needed but I thought it's maybe better safe than sorry. |
Member
They are usually worth forgetting. |
Closed
z16
added a commit
that referenced
this pull request
Nov 4, 2024
Fixing errors on Linkshell/Linkpearls/Pearlsacks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change fixes two errors that happen when parsing Linkshells with certain combinations of characters that result in a bitpacked LS name that contains zeroed bytes in the middle.
First change fixes the
nilerror, second change detects the length of the name properly.