Skip to content

Commit

Permalink
Disable unlimited flag in fuzzing builds
Browse files Browse the repository at this point in the history
The load-specific `unlimited` flag is known to be fuzzing-unfriendly.
  • Loading branch information
kleisauke committed Nov 17, 2024
1 parent 4ece872 commit 0c744d2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions libvips/foreign/heifload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,12 +1107,14 @@ vips_foreign_load_heif_class_init(VipsForeignLoadHeifClass *class)
G_STRUCT_OFFSET(VipsForeignLoadHeif, autorotate),
FALSE);

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VIPS_ARG_BOOL(class, "unlimited", 22,
_("Unlimited"),
_("Remove all denial of service limits"),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET(VipsForeignLoadHeif, unlimited),
FALSE);
#endif
}

static gint64
Expand Down
2 changes: 2 additions & 0 deletions libvips/foreign/jpegload.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,14 @@ vips_foreign_load_jpeg_class_init(VipsForeignLoadJpegClass *class)
G_STRUCT_OFFSET(VipsForeignLoadJpeg, autorotate),
FALSE);

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VIPS_ARG_BOOL(class, "unlimited", 22,
_("Unlimited"),
_("Remove all denial of service limits"),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET(VipsForeignLoadJpeg, unlimited),
FALSE);
#endif
}

static void
Expand Down
2 changes: 2 additions & 0 deletions libvips/foreign/pngload.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ vips_foreign_load_png_class_init(VipsForeignLoadPngClass *class)
load_class->header = vips_foreign_load_png_header;
load_class->load = vips_foreign_load_png_load;

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VIPS_ARG_BOOL(class, "unlimited", 23,
_("Unlimited"),
_("Remove all denial of service limits"),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET(VipsForeignLoadPng, unlimited),
FALSE);
#endif
}

static void
Expand Down
2 changes: 2 additions & 0 deletions libvips/foreign/spngload.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,14 @@ vips_foreign_load_png_class_init(VipsForeignLoadPngClass *class)
load_class->header = vips_foreign_load_png_header;
load_class->load = vips_foreign_load_png_load;

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VIPS_ARG_BOOL(class, "unlimited", 23,
_("Unlimited"),
_("Remove all denial of service limits"),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET(VipsForeignLoadPng, unlimited),
FALSE);
#endif
}

static void
Expand Down
2 changes: 2 additions & 0 deletions libvips/foreign/svgload.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,12 +727,14 @@ vips_foreign_load_svg_class_init(VipsForeignLoadSvgClass *class)
G_STRUCT_OFFSET(VipsForeignLoadSvg, scale),
0.0, 100000.0, 1.0);

#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
VIPS_ARG_BOOL(class, "unlimited", 23,
_("Unlimited"),
_("Allow SVG of any size"),
VIPS_ARGUMENT_OPTIONAL_INPUT,
G_STRUCT_OFFSET(VipsForeignLoadSvg, unlimited),
FALSE);
#endif
}

static void
Expand Down
3 changes: 0 additions & 3 deletions test/test-suite/test_foreign.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,9 +1426,6 @@ def heif_valid(im):
im = pyvips.Image.heifload(AVIF_FILE_HUGE)
assert im.avg() == 0.0

im = pyvips.Image.heifload(AVIF_FILE_HUGE, unlimited=True)
assert im.avg() == 0.0

@skip_if_no("heifsave")
def test_avifsave(self):
self.save_load_buffer("heifsave_buffer", "heifload_buffer",
Expand Down

0 comments on commit 0c744d2

Please sign in to comment.