$OpenBSD: patch-src_libFLAC_stream_encoder_c,v 1.1 2013/07/18 15:10:55 naddy Exp $

Fix an arithmetic overflow in the RICE2 partitioner.
https://git.xiph.org/?p=flac.git;a=commit;h=6f7ec60c7e7f05f5ab0b1cf6b7b0945e44afcd4b

--- src/libFLAC/stream_encoder.c.orig	Sun May 26 11:30:33 2013
+++ src/libFLAC/stream_encoder.c	Thu Jul 18 16:39:48 2013
@@ -3784,7 +3784,7 @@ void precompute_partition_info_sums_(
 		/* slightly pessimistic but still catches all common cases */
 		/* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
 		if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) {
-			FLAC__uint32 abs_residual_partition_sum;
+			FLAC__uint64 abs_residual_partition_sum;
 
 			for(partition = residual_sample = 0; partition < partitions; partition++) {
 				end += default_partition_samples;
