Skip to content

Runtime error when testing calls to kseq.zig library #1

@jelber2

Description

@jelber2

After compiling and running

with an example FASTA file

git clone https://github.com/jelber2/zig-bio

cd zig-bio

zig build-exe fasta.zig

./fasta <(echo -e ">1\nAAAA")

thread 143229 panic: index out of bounds: index 256, len 256
/home/jelber2/git/zig-bio/src/kseq.zig:292:17: 0x20da6c in ks_getuntil (fasta)
        strbuf.s[@intCast(usize, l)] = @intCast(u8, c);
                ^
/home/jelber2/git/zig-bio/src/kseq.zig:226:76: 0x20f4fa in kseq_read (fasta)
        if (c != '\n') _ = try ks_getuntil(allocator, ks, KS_SEP_LINE, &seq.comment, null, file);
                                                                           ^
/home/jelber2/git/zig-bio/src/fasta.zig:30:52: 0x210381 in main (fasta)
        const read_result = kseq.kseq_read(std.heap.page_allocator, seq, file);
                                                   ^
/home/jelber2/git/zig/build/stage3/lib/zig/std/start.zig:609:37: 0x20b81e in posixCallMainAndExit (fasta)
            const result = root.main() catch |err| {
                                    ^
/home/jelber2/git/zig/build/stage3/lib/zig/std/start.zig:368:5: 0x20b281 in _start (fasta)
    @call(.never_inline, posixCallMainAndExit, .{});
    ^
Aborted (core dumped)

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