OLD | NEW |
1 /* $Id: tif_strip.c,v 1.35 2012-06-06 05:33:55 fwarmerdam Exp $ */ | 1 /* $Id: tif_strip.c,v 1.36 2015-06-07 22:35:40 bfriesen Exp $ */ |
2 | 2 |
3 /* | 3 /* |
4 * Copyright (c) 1991-1997 Sam Leffler | 4 * Copyright (c) 1991-1997 Sam Leffler |
5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. | 5 * Copyright (c) 1991-1997 Silicon Graphics, Inc. |
6 * | 6 * |
7 * Permission to use, copy, modify, distribute, and sell this software and | 7 * Permission to use, copy, modify, distribute, and sell this software and |
8 * its documentation for any purpose is hereby granted without fee, provided | 8 * its documentation for any purpose is hereby granted without fee, provided |
9 * that (i) the above copyright notices and this permission notice appear in | 9 * that (i) the above copyright notices and this permission notice appear in |
10 * all copies of the software and related documentation, and (ii) the names of | 10 * all copies of the software and related documentation, and (ii) the names of |
11 * Sam Leffler and Silicon Graphics may not be used in any advertising or | 11 * Sam Leffler and Silicon Graphics may not be used in any advertising or |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 scanline_size = (samplingrow_size/ycbcrsubsampling[1]); | 310 scanline_size = (samplingrow_size/ycbcrsubsampling[1]); |
311 } | 311 } |
312 else | 312 else |
313 { | 313 { |
314 uint64 scanline_samples; | 314 uint64 scanline_samples; |
315 scanline_samples=_TIFFMultiply64(tif,td->td_imagewidth,t
d->td_samplesperpixel,module); | 315 scanline_samples=_TIFFMultiply64(tif,td->td_imagewidth,t
d->td_samplesperpixel,module); |
316 scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,scanlin
e_samples,td->td_bitspersample,module),8); | 316 scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,scanlin
e_samples,td->td_bitspersample,module),8); |
317 } | 317 } |
318 } | 318 } |
319 else | 319 else |
| 320 { |
320 scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,td->td_imagewid
th,td->td_bitspersample,module),8); | 321 scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,td->td_imagewid
th,td->td_bitspersample,module),8); |
| 322 } |
| 323 if (scanline_size == 0) |
| 324 { |
| 325 TIFFErrorExt(tif->tif_clientdata,module,"Computed scanline size
is zero"); |
| 326 return 0; |
| 327 } |
321 return(scanline_size); | 328 return(scanline_size); |
322 } | 329 } |
323 tmsize_t | 330 tmsize_t |
324 TIFFScanlineSize(TIFF* tif) | 331 TIFFScanlineSize(TIFF* tif) |
325 { | 332 { |
326 static const char module[] = "TIFFScanlineSize"; | 333 static const char module[] = "TIFFScanlineSize"; |
327 uint64 m; | 334 uint64 m; |
328 tmsize_t n; | 335 tmsize_t n; |
329 m=TIFFScanlineSize64(tif); | 336 m=TIFFScanlineSize64(tif); |
330 n=(tmsize_t)m; | 337 n=(tmsize_t)m; |
331 » if ((uint64)n!=m) | 338 » if ((uint64)n!=m) { |
332 » { | |
333 TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic over
flow"); | 339 TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic over
flow"); |
334 n=0; | 340 n=0; |
335 } | 341 } |
336 return(n); | 342 return(n); |
337 } | 343 } |
338 | 344 |
339 /* | 345 /* |
340 * Return the number of bytes required to store a complete | 346 * Return the number of bytes required to store a complete |
341 * decoded and packed raster scanline (as opposed to the | 347 * decoded and packed raster scanline (as opposed to the |
342 * I/O size returned by TIFFScanlineSize which may be less | 348 * I/O size returned by TIFFScanlineSize which may be less |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 380 } |
375 | 381 |
376 /* vim: set ts=8 sts=8 sw=8 noet: */ | 382 /* vim: set ts=8 sts=8 sw=8 noet: */ |
377 /* | 383 /* |
378 * Local Variables: | 384 * Local Variables: |
379 * mode: c | 385 * mode: c |
380 * c-basic-offset: 8 | 386 * c-basic-offset: 8 |
381 * fill-column: 78 | 387 * fill-column: 78 |
382 * End: | 388 * End: |
383 */ | 389 */ |
384 | |
OLD | NEW |