Skip to content

Report decoding inconsistency between app and apple_cryptography.py #239

Description

@adntaha

Hi,

I'm trying to increase my understanding of this codebase, and while doing so, I stumbled upon the following inconsistency. In the following snippet, i in lowercase is for a signed int.

def decode_tag(data):
latitude = struct.unpack(">i", data[0:4])[0] / 10000000.0
longitude = struct.unpack(">i", data[4:8])[0] / 10000000.0

Meanwhile, in the web app, the same bytes get decoded as an Uint:

static FindMyLocationReport _decodePayload(
Uint8List payload, FindMyReport report) {
final latitude = payload.buffer.asByteData(0, 4).getUint32(0, Endian.big);
final longitude = payload.buffer.asByteData(4, 4).getUint32(0, Endian.big);

So, I don't get it. Are both of these approaches valid because lat/long don't ever get high enough, or is one of these going to lead to a bug?

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions