Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out of order read in git master with arrajoin and jpg images #2440

Closed
jcupitt opened this issue Sep 17, 2021 · 2 comments
Closed

out of order read in git master with arrajoin and jpg images #2440

jcupitt opened this issue Sep 17, 2021 · 2 comments
Labels
Milestone

Comments

@jcupitt
Copy link
Member

jcupitt commented Sep 17, 2021

This sample program:

/* compile with:
 *
 * gcc -g -Wall try330.c `pkg-config vips --cflags --libs`
 */

#include <vips/vips.h>
    
int 
main(int argc, char **argv) 
{
    VipsObject *context;
    VipsImage *image;
    VipsImage **images;
    int n_images;
    int i;

    if (VIPS_INIT(argv[0]))
        vips_error_exit(NULL);

    if (argc != 4)
        vips_error_exit("usage: %s infile outfile 4", argv[0]);

    n_images = atoi(argv[3]);
    context = VIPS_OBJECT(vips_image_new());
    images = (VipsImage **) vips_object_local_array(context, n_images);

    for (i = 0; i < n_images; i++)
        if (!(images[i] = vips_image_new_from_file(argv[1], 
                "access", VIPS_ACCESS_SEQUENTIAL, NULL))) {
            g_object_unref(context);
            vips_error_exit(NULL);
        }

    if (vips_arrayjoin(images, &image, n_images, "across", 1, NULL)) {
        g_object_unref(context);
        vips_error_exit(NULL);
    }

    if (vips_image_write_to_file(image, argv[2], NULL)) {
        g_object_unref(image);
        g_object_unref(context);
        vips_error_exit(NULL);
    }

    g_object_unref(image);
    g_object_unref(context);

    return 0;
}

Fails like this:

$ ./a.out ~/pics/k2.jpg x.tif 1
$ ./a.out ~/pics/k2.jpg x.tif 10
$ ./a.out ~/pics/k2.jpg x.tif 100

(process:806177): VIPS-WARNING **: 18:58:54.572: error in tile 0 x 1920
VipsJpeg: out of order read at line 2048

With git master libvips. This only fails with JPEG source images. The output format doesn't matter.

@jcupitt jcupitt added the bug label Sep 17, 2021
@jcupitt
Copy link
Member Author

jcupitt commented Sep 17, 2021

Context kleisauke/net-vips#135

@jcupitt jcupitt added this to the 8.12 milestone Oct 24, 2021
@jcupitt
Copy link
Member Author

jcupitt commented Nov 4, 2021

Seems to be fixed, phew,

@jcupitt jcupitt closed this as completed Nov 4, 2021
jcupitt added a commit that referenced this issue Nov 4, 2021
This patch makes arrayjoin leave a bigger margin off the end of each
input image. This can help some loaders which have large output caches.

See #2440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant