Lines 17-22
Link Here
|
17 |
|
17 |
|
18 |
#include <png.h> |
18 |
#include <png.h> |
19 |
|
19 |
|
|
|
20 |
#include "oversized.h" |
21 |
|
20 |
#include <caml/mlvalues.h> |
22 |
#include <caml/mlvalues.h> |
21 |
#include <caml/alloc.h> |
23 |
#include <caml/alloc.h> |
22 |
#include <caml/memory.h> |
24 |
#include <caml/memory.h> |
Lines 81-86
value read_png_file_as_rgb24( name )
Link Here
|
81 |
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
83 |
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
82 |
&interlace_type, NULL, NULL); |
84 |
&interlace_type, NULL, NULL); |
83 |
|
85 |
|
|
|
86 |
if (oversized (width, height)) |
87 |
failwith_oversized("png"); |
88 |
|
84 |
if ( color_type == PNG_COLOR_TYPE_GRAY || |
89 |
if ( color_type == PNG_COLOR_TYPE_GRAY || |
85 |
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { |
90 |
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { |
86 |
png_set_gray_to_rgb(png_ptr); |
91 |
png_set_gray_to_rgb(png_ptr); |
Lines 102-111
value read_png_file_as_rgb24( name )
Link Here
|
102 |
|
107 |
|
103 |
rowbytes = png_get_rowbytes(png_ptr, info_ptr); |
108 |
rowbytes = png_get_rowbytes(png_ptr, info_ptr); |
104 |
|
109 |
|
|
|
110 |
if (oversized (rowbytes, height)) |
111 |
failwith_oversized("png"); |
112 |
|
105 |
{ |
113 |
{ |
106 |
int i; |
114 |
int i; |
107 |
png_bytep *row_pointers; |
115 |
png_bytep *row_pointers; |
108 |
|
116 |
|
|
|
117 |
if (oversized (sizeof (png_bytep), height)) |
118 |
failwith_oversized("png"); |
119 |
|
109 |
row_pointers = (png_bytep*) stat_alloc(sizeof(png_bytep) * height); |
120 |
row_pointers = (png_bytep*) stat_alloc(sizeof(png_bytep) * height); |
110 |
|
121 |
|
111 |
res = alloc_tuple(3); |
122 |
res = alloc_tuple(3); |
Lines 235-240
value read_png_file( name )
Link Here
|
235 |
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
246 |
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
236 |
&interlace_type, NULL, NULL); |
247 |
&interlace_type, NULL, NULL); |
237 |
|
248 |
|
|
|
249 |
if (oversized (width, height)) |
250 |
failwith_oversized("png"); |
251 |
|
238 |
if ( color_type == PNG_COLOR_TYPE_GRAY || |
252 |
if ( color_type == PNG_COLOR_TYPE_GRAY || |
239 |
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { |
253 |
color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) { |
240 |
png_set_gray_to_rgb(png_ptr); |
254 |
png_set_gray_to_rgb(png_ptr); |
Lines 251-256
value read_png_file( name )
Link Here
|
251 |
|
265 |
|
252 |
rowbytes = png_get_rowbytes(png_ptr, info_ptr); |
266 |
rowbytes = png_get_rowbytes(png_ptr, info_ptr); |
253 |
|
267 |
|
|
|
268 |
if (oversized (rowbytes, height)) |
269 |
failwith_oversized("png"); |
270 |
|
254 |
/* |
271 |
/* |
255 |
fprintf(stderr, "pngread.c: actual loading\n"); fflush(stderr); |
272 |
fprintf(stderr, "pngread.c: actual loading\n"); fflush(stderr); |
256 |
*/ |
273 |
*/ |
Lines 259-264
fprintf(stderr, "pngread.c: actual loadi
Link Here
|
259 |
png_bytep *row_pointers; |
276 |
png_bytep *row_pointers; |
260 |
char mesg[256]; |
277 |
char mesg[256]; |
261 |
|
278 |
|
|
|
279 |
if (oversized (sizeof (png_bytep), height)) |
280 |
failwith_oversized("png"); |
281 |
|
262 |
row_pointers = (png_bytep*)stat_alloc(sizeof(png_bytep) * height); |
282 |
row_pointers = (png_bytep*)stat_alloc(sizeof(png_bytep) * height); |
263 |
res = alloc_tuple(3); |
283 |
res = alloc_tuple(3); |
264 |
|
284 |
|