Skip to content

Fix SIN v1/v2 files always falling through to v4 parser - #232

Open
frankfrot30 wants to merge 1 commit into
Androxyde:masterfrom
frankfrot30:fix/sinfile-v1-v2-parsing
Open

Fix SIN v1/v2 files always falling through to v4 parser#232
frankfrot30 wants to merge 1 commit into
Androxyde:masterfrom
frankfrot30:fix/sinfile-v1-v2-parsing

Conversation

@frankfrot30

Copy link
Copy Markdown

Summary

  • SinFile's constructor checked version==1, version==2, version==3 as three independent if statements instead of an if / else if chain.
  • Only the version==3 check had an else branch (which attempts v4/tar-gzip parsing).
  • As a result, any file with version==1 or version==2 was 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.
  • This breaks flashing for every device using SIN v1/v2 packages, i.e. the whole 2011-2012 Xperia line (X10, arc, ray, S, P, U, sola, acro, etc.).

Fix

Changed the two independent if statements to else if, so v4 parsing is only attempted when the version byte doesn't match 1, 2, or 3.

Test plan

  • Confirmed the bug: read the raw bytes of a Sony Xperia U (ST25i) loader.sin from an official FTF, first byte is 0x02 (SIN v2).
  • Reproduced "Not a sin file" / "Error flashing. Aborted" with the original code during a real flash attempt on an ST25i in flashmode.
  • Applied the fix, rebuilt (Flashtool:compileJava), ran from source (Flashtool:run), and confirmed the ST25i firmware now flashes successfully past the loader stage.

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.
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

Successfully merging this pull request may close these issues.

1 participant