Skip to content

[bug] infinite loop in into_stream_writer_with_size #206

Closed
@lovasoa

Description

@lovasoa

The following rust code:

let file = OpenOptions::new().write(true).create(true).open("/tmp/myimage.png").unwrap();
let encoder = png::Encoder::new(file, 2, 2);
encoder.write_header().unwrap().into_stream_writer_with_size(2);

never exits and creates the following never-ending file :

00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 02 00 00 00 02  08 00 00 00 00 57 dd 52  |.............W.R|
00000020  f8 00 00 00 02 49 44 41  54 02 00 4e cd df 38 00  |.....IDAT..N..8.|
00000030  00 00 02 49 44 41 54 00  00 7c fb bd ba 00 00 00  |...IDAT..|......|
00000040  02 49 44 41 54 ff ff c2  dd af 45 00 00 00 02 49  |.IDAT.....E....I|
00000050  44 41 54 02 00 4e cd df  38 00 00 00 02 49 44 41  |DAT..N..8....IDA|
00000060  54 00 00 7c fb bd ba 00  00 00 02 49 44 41 54 ff  |T..|.......IDAT.|
00000070  ff c2 dd af 45 00 00 00  02 49 44 41 54 02 00 4e  |....E....IDAT..N|
00000080  cd df 38 00 00 00 02 49  44 41 54 00 00 7c fb bd  |..8....IDAT..|..|
00000090  ba 00 00 00 02 49 44 41  54 ff ff c2 dd af 45 00  |.....IDAT.....E.|
000000a0  00 00 02 49 44 41 54 02  00 4e cd df 38 00 00 00  |...IDAT..N..8...|
000000b0  02 49 44 41 54 00 00 7c  fb bd ba 00 00 00 02 49  |.IDAT..|.......I|
000000c0  44 41 54 ff ff c2 dd af  45 00 00 00 02 49 44 41  |DAT.....E....IDA|
...

00 00 00 02 49 44 41 54 ff ff c2 dd af 45 00 00 00 02 49 44 41 54 02 00 4e cd df 38 00 00 00 02 49 44 41 54 00 00 7c fb bd ba repeats forever)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions