Fix SIN v1/v2 files always falling through to v4 parser - #232
Open
frankfrot30 wants to merge 1 commit into
Open
Conversation
The version checks in SinFile's constructor were three independent if statements instead of an if/else-if chain, so any file with version==1 or version==2 was parsed correctly and then immediately re-parsed by the v4 (tar/gzip) branch, which always failed with "Not a sin file" since v1/v2 sin files are not tar/gzip archives. This broke flashing for every device using SIN v1/v2 packages (2011-2012 Xperia line: X10, arc, ray, S, P, U, sola, acro, etc.), confirmed on a Sony Xperia U (ST25i) where loader.sin uses version 2.
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.
Summary
SinFile's constructor checkedversion==1,version==2,version==3as three independentifstatements instead of anif / else ifchain.version==3check had anelsebranch (which attempts v4/tar-gzip parsing).version==1orversion==2was parsed correctly and then immediately re-parsed by the v4 branch, which always fails with"Not a sin file"since v1/v2 sin files are not tar/gzip archives.Fix
Changed the two independent
ifstatements toelse if, so v4 parsing is only attempted when the version byte doesn't match 1, 2, or 3.Test plan
loader.sinfrom an official FTF, first byte is0x02(SIN v2)."Not a sin file"/"Error flashing. Aborted"with the original code during a real flash attempt on an ST25i in flashmode.Flashtool:compileJava), ran from source (Flashtool:run), and confirmed the ST25i firmware now flashes successfully past the loader stage.