$OpenBSD: patch-pbm_pbmreduce_c,v 1.1 2003/03/29 04:13:54 brad Exp $ --- pbm/pbmreduce.c.orig Wed Apr 26 15:24:02 2000 +++ pbm/pbmreduce.c Fri Mar 28 20:22:06 2003 @@ -92,8 +92,9 @@ main( argc, argv ) if ( halftone == QT_FS ) { /* Initialize Floyd-Steinberg. */ - thiserr = (long*) malloc( ( newcols + 2 ) * sizeof(long) ); - nexterr = (long*) malloc( ( newcols + 2 ) * sizeof(long) ); + overflow_add(newcols, 2); + thiserr = (long*) malloc2( ( newcols + 2 ), sizeof(long) ); + nexterr = (long*) malloc2( ( newcols + 2 ), sizeof(long) ); if ( thiserr == 0 || nexterr == 0 ) pm_error( "out of memory" );