$OpenBSD: patch-mp3lib_layer2_c,v 1.5 2007/04/19 08:37:09 ajacoutot Exp $
--- mp3lib/layer2.c.orig	Sun Jun 11 20:35:43 2006
+++ mp3lib/layer2.c	Thu Apr 19 09:41:04 2007
@@ -294,6 +294,11 @@ static int do_layer2(struct frame *fr,int outmode)
   fr->jsbound = (fr->mode == MPG_MD_JOINT_STEREO) ?
      (fr->mode_ext<<2)+4 : fr->II_sblimit;
 
+  if (fr->jsbound > fr->II_sblimit) {
+         fprintf(stderr, "Truncating stereo boundary to sideband limit.\n");
+         fr->jsbound=fr->II_sblimit;
+  }
+
   if(stereo == 1 || single == 3)
     single = 0;
 
