Skip to content

getFloat allows to read uninitialised memory #46

@weissi

Description

@weissi

return self.withVeryUnsafeBytes { ptr in

The code above allows to read uninitialised memory. I'd recommend

    func getFloat(index: Int) -> Float? {
        return self.getInteger(at: index, as: UInt32.self).map { Float(bitPattern: $0) }
    }

    func getDouble(index: Int) -> Double? {
        return self.getInteger(at: index, as: UInt64.self).map { Double(bitPattern: $0) }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions