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

[sqlite IndexedDB] When appropriate, reinterpret pair as double #1803

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ee/katc/deserialize_firefox.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
tagBooleanObject uint32 = 0xffff000a
tagStringObject uint32 = 0xffff000b
tagEndOfKeys uint32 = 0xffff0013
tagFloatMax uint32 = 0xfff00000
)

// deserializeFirefox deserializes a JS object that has been stored by Firefox
Expand Down Expand Up @@ -151,7 +152,13 @@ func deserializeObject(srcReader io.ByteReader) (map[string][]byte, error) {
case tagNull, tagUndefined:
resultObj[nextKeyStr] = nil
default:
return nil, fmt.Errorf("cannot process object key `%s`: unknown tag type `%x` with data `%d`", nextKeyStr, valTag, valData)
if valTag < tagFloatMax {
// We want to reinterpret (valTag, valData) as a single double value instead
d := uint64(valData) | uint64(valTag)<<32
resultObj[nextKeyStr] = []byte(strconv.FormatUint(d, 10))
} else {
return nil, fmt.Errorf("cannot process object key `%s`: unknown tag type `%x` with data `%d`", nextKeyStr, valTag, valData)
}
}
}

Expand Down
Loading