Skip to content

Profile import fails with EOF error for valid .bpf files since v1.13.0 #99

@hdrover

Description

@hdrover

Importing a valid .bpf profile file fails with "Failed to import profile from URL EOF" since sing-box for android v1.13.0. Files exported by the app itself import fine, but files generated externally (e.g. by a script using standard gzip) may fail, even though the binary format is identical and correct.

The root cause is in StubReader.ReadByte() (common/varbin/data_if.go) — it ignores the n return value from Read(), discarding a successfully read byte when Read() returns data together with EOF, which is valid per the io.Reader contract. Whether the bug triggers depends on the internal structure of the gzip stream produced by the encoder.

The issue was exposed by commit SagerNet/sing-box@1af14a0, which replaced io.ReadFull() with byte-by-byte ReadByte() in readString().

Fix: #98

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