Skip to content

Pipes not working reliably for PPM images #2240

Closed
@ewelot

Description

@ewelot

It seems that using pipes with PPM images is not working in a reliable way.
This is a follow up on issue 1916 which I am not able to re-open again, so I had to open a new issue instead.
I am using the 8.10.5 codebase with patches added according to the fixes mentiones in issues 1913 and 1916.

I am using the following simple python program:

#!/usr/bin/python3
  
import sys
import pyvips

infilename = sys.argv[1]
outfilename = sys.argv[2]

if (infilename != '-'):
    image = pyvips.Image.new_from_file(infilename)
else:
    source = pyvips.Source.new_from_descriptor(sys.stdin.fileno())
    image = pyvips.Image.new_from_source(source, "")

outimage = image.linear(1, 1)

if (outfilename != '-'):
    outimage.ppmsave(outfilename, strip=1)
else:
    target = pyvips.Target.new_to_descriptor(sys.stdout.fileno())
    outimage.write_to_target(target, ".ppm", strip=True)

A simple test which causes an error (in most cases, but not always):

$ convert rose: -resize 10000% -depth 16 ppm:- | test.py - - > x.ppm
malloc(): corrupted top size
Abgebrochen

and other commands which seamingly run without problems:

$ convert rose: -resize 10000% -depth 16 jpg:- | test.py - - > x.ppm
$ convert rose: -resize 1000% -depth 16 ppm:- | test.py - - > x.ppm

Any help is much appreciated.
Thanks,
Thomas

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions