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

Handle invalid timezone values #42

Merged
merged 2 commits into from
Mar 22, 2017
Merged

Conversation

tomchy
Copy link

@tomchy tomchy commented Mar 21, 2017

Possible fix for #15
Returned timezone value is not a valid BCD number (0x2C). The timezone value should be close to +7 (+28 quarters, 0x28 in BCD). Currently I can see four interpretations:

  • not masked, badly positioned sign bit: 0x2C & 0x77 = 0x24 (+6 h)
  • badly positioned sign bit: 0x2C = -0x24 (-6 h)
  • not reorganized bytes: 0x2C -> 0xC2 = -0x42 (-10.5 h)
  • overloaded BCD value: 0x2C + 0x6 = 0x32 (+8h)

According to the fact that the SMS was send from Jakarta (+7), negative values are (most probably) invalid (option 2 and 3).
Indonesia has timezones +7, +8 and +9, so 4th option is more probable that the 1st one (why local message should leave the country?).

This PR changes timezone calculation using 4th option and redefines unit test, which has problematic status PDU.

@tomchy tomchy changed the title Pr/pdu timezone fix Handle invalid timezone values Mar 21, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 90.021% when pulling 2849814 on tomchy:pr/pdu-timezone-fix into 459159f on babca:master.

@babca
Copy link
Owner

babca commented Mar 22, 2017

You've done some solid detective work here.

@babca babca merged commit 6e69c26 into babca:master Mar 22, 2017
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.

3 participants