Closed Bug 1357946 Opened 8 years ago Closed 8 years ago

Crash in TabsPayload.Tab.(fromJSON(JSON) -> TabsPayload.Tab?).(getLastUsed #1)(JSON) -> UInt64?

Categories

(Firefox for iOS :: General, enhancement, P1)

Other
iOS
enhancement

Tracking

()

RESOLVED FIXED
Iteration:
1.20
Tracking Status
fxios 7.3 ---
fxios-v7.0 --- affected
fxios-v7.1 --- affected
fxios-v7.2 --- affected

People

(Reporter: st3fan, Assigned: rnewman)

Details

(Whiteboard: [TopCrasher][MobileCore])

Attachments

(2 files)

The trace is a bit more complex, but the method in the bug summary is high up and has a line number attached.
Does TabsPayload.isValid need a more extensive check? It only checks if self["tabs"] is an array, but it does not validate the items inside the array.
Flags: needinfo?(rnewman)
Whiteboard: [TopCrasher]
Iteration: --- → 1.20
Priority: -- → P1
Whiteboard: [TopCrasher] → [TopCrasher][MobileCore
Whiteboard: [TopCrasher][MobileCore → [TopCrasher][MobileCore]
(In reply to Stefan Arentz [:st3fan] from comment #2) > Does TabsPayload.isValid need a more extensive check? It only checks if > self["tabs"] is an array, but it does not validate the items inside the > array. No, it relies on failable processing internally -- we'd rather have the valid tabs of a client than have one problem make the whole client 'disappear'. We do that here: func getLastUsed(_ json: JSON) -> Timestamp? { // This might be a string or a number. if let num = json["lastUsed"].int64 { return Timestamp(num * 1000) } if let num = json["lastUsed"].string { // Try parsing. return decimalSecondsStringToTimestamp(num) } return nil } Obviously something is going on here: despite what the documentation says, the string case should be a failure in extremis (that's a really, really old bug). https://dxr.mozilla.org/mozilla-central/source/services/sync/modules/engines/tabs.js#193 is what desktop does: integer seconds. The string case is not happening in extremis: again, this is a case of iOS now producing records that we fail to parse. A desktop tab record looks like this: {"title": "Gradual OLTP DB Development - from Zero to 10 Billion Transactions per Year and Beyond - IT Hare on Soft.ware", "urlHistory": ["http://ithare.com/gradual-oltp-db-development-from-zero-to-10-billion-transactions-per-year-and-beyond/"], "icon": "http://ithare.com/favicon.ico", "lastUsed": 1492649651} an iOS Firefox 7.* record looks like this: {"icon": null, "title": "https://www.outsideonline.com/1785631/whats-worlds-best-midlayer", "lastUsed": "1492316843992", "urlHistory": ["https://www.outsideonline.com/1785631/whats-worlds-best-midlayer"]} As you can see, not only is that `lastUsed` at the wrong granularity, it's also not decimal seconds. So there are two bugs here: - We're not resilient against some kind of malformed data. The code looks fine, but apparently it's not. - We're generating invalid tab records.
Flags: needinfo?(rnewman)
Attached file PR
Reviews requested on GitHub.
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Attachment #8859824 - Flags: review?
Attachment #8859824 - Flags: review? → review+
Whiteboard: [TopCrasher][MobileCore] → [TopCrasher][MobileCore][needsuplift]
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Whiteboard: [TopCrasher][MobileCore][needsuplift] → [TopCrasher][MobileCore]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: