Date: Tue, 03 Aug 2004 16:55:58 +0200 (CEST) Message-Id: <20040803.165558.23025242.andrieu at ijm.jussieu.fr> To: 263239 at bugs.debian.org Cc: c.pourbaix at brutele.be, lablgtk at kaba.or.jp Subject: Re: Bug#263239: liblablgtk2-ocaml-dev: GdkPixbuf.from_data fails with Invalid_argument From: Olivier Andrieu In-Reply-To: <20040803143119.GC14871 at pegasos> References: <200408031323.ATD04770 at mirapoint5.brutele.be> <20040803143119.GC14871@pegasos> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sven Luther [Tue, 3 Aug 2004]: > Ok. Jacques and other lablgtk upstreams, what do you think of this > patch ? > > > --- gdkPixbuf.ml 2004-03-24 01:49:00.000000000 +0100 > > +++ gdkPixbuf-patch.ml 2004-08-03 15:06:30.000000000 +0200 > > @@ -67,7 +67,9 @@ > > let nc = if has_alpha then 4 else 3 in > > let rowstride = match rowstride with None -> width * nc | Some r -> r in > > if bits <> 8 || rowstride < width * nc || width <= 0 || height <= 0 > > - || Gpointer.length data < (rowstride * (height - 1) + width) * nc > > + (* rowstride is already width (+ pitch) * bytes_per_pixel *) > > + (*|| Gpointer.length data < (rowstride * (height - 1) + width) * nc*) > > + || Gpointer.length data < (rowstride * (height - 1) + width) > > then invalid_arg "GdkPixbuf.from_data"; > > _from_data data ~has_alpha ~bits ~width ~height ~rowstride It should rather be: --- gdkPixbuf.ml.~1.9.~ 2004-03-24 01:49:00.000000000 +0100 +++ gdkPixbuf.ml 2004-08-03 16:51:38.592970653 +0200 @@ -67,7 +67,7 @@ let nc = if has_alpha then 4 else 3 in let rowstride = match rowstride with None -> width * nc | Some r -> r in if bits <> 8 || rowstride < width * nc || width <= 0 || height <= 0 - || Gpointer.length data < (rowstride * (height - 1) + width) * nc + || Gpointer.length data < rowstride * (height - 1) + width * nc then invalid_arg "GdkPixbuf.from_data"; -- Olivier