From 7a9fefbf73a7a1f3453f6e3d19aa40e858487f68 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 20 Aug 2008 22:17:30 +0000 Subject: Improve error handling for broken input streams and make the backend deal with a dying frontend. Fixes PR pkg/39378. --- audio/mpg123/distinfo | 6 +-- audio/mpg123/patches/patch-ai | 94 ++++++++++++++++++++++++++----------------- audio/mpg123/patches/patch-av | 22 ++++++++-- 3 files changed, 78 insertions(+), 44 deletions(-) (limited to 'audio') diff --git a/audio/mpg123/distinfo b/audio/mpg123/distinfo index 96b32f4c682..905c45bb5ac 100644 --- a/audio/mpg123/distinfo +++ b/audio/mpg123/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.28 2008/05/20 18:36:47 tnn Exp $ +$NetBSD: distinfo,v 1.29 2008/08/20 22:17:30 martin Exp $ SHA1 (mpg123/mpg123-0.59r.tar.gz) = c32fe242f4506d218bd19a51a4034da9fdc79493 RMD160 (mpg123/mpg123-0.59r.tar.gz) = 17d47ca04fdcac5e2d71f95ccbd23b61b5ed8b3c @@ -14,7 +14,7 @@ SHA1 (patch-ae) = 9ac13c978bdf498cbd5e9fa0777a51559fdb2403 SHA1 (patch-af) = 309075bc6fd4b689b711f0ae84f2e5c829609452 SHA1 (patch-ag) = c27b6a441573939dc23268a6937905d038d6a66b SHA1 (patch-ah) = e1419bc6d25360d0825041028b6b3f485bcf5f43 -SHA1 (patch-ai) = eff8d2d5602056a052855dc81046642779a61272 +SHA1 (patch-ai) = da7debed75a978d096e9f27a157635692a8cd918 SHA1 (patch-aj) = b828a5e35a03b307d46cd07356624d19b9d56777 SHA1 (patch-ak) = b30898cff26859eca0d23ea8cfdd461920b978a8 SHA1 (patch-al) = 88dec640d40e6a3f1828096a4ff7b5a4dbd0a222 @@ -27,5 +27,5 @@ SHA1 (patch-ar) = e81771bf72da97d898f9320fb6c529e5a1151050 SHA1 (patch-as) = 8765b22c556cdc217f6270f3a5e70b40b36b9229 SHA1 (patch-at) = 9a64a62f7d1d115e3d36dbb0f08762d4b0eb1e2b SHA1 (patch-au) = 02c480cbb6ff8ab904be93eaf319b43f4f02d588 -SHA1 (patch-av) = 9c25c4a82042ca862409284fb2616a613485ff76 +SHA1 (patch-av) = 4c771cd77091af3e5ade356d7e7230ee4ae1efc0 SHA1 (patch-aw) = ba937829caf7f3ca042dca87f5b3f83a0cf2611a diff --git a/audio/mpg123/patches/patch-ai b/audio/mpg123/patches/patch-ai index 6d5ac564f82..00c2d51b813 100644 --- a/audio/mpg123/patches/patch-ai +++ b/audio/mpg123/patches/patch-ai @@ -1,8 +1,8 @@ -$NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ +$NetBSD: patch-ai,v 1.5 2008/08/20 22:17:30 martin Exp $ --- layer3.c.orig 1999-04-21 17:25:18.000000000 +0200 -+++ layer3.c -@@ -109,54 +109,54 @@ void init_layer3(int down_sample_sblimit ++++ layer3.c 2008-08-20 15:48:42.000000000 +0200 +@@ -109,54 +109,54 @@ int i,j,k,l; for(i=-256;i<118+4;i++) @@ -81,7 +81,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } for(j=0;j<4;j++) { -@@ -169,10 +169,10 @@ void init_layer3(int down_sample_sblimit +@@ -169,10 +169,10 @@ for(i=0;i<16;i++) { double t = tan( (double) i * M_PI / 12.0 ); @@ -96,7 +96,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ for(j=0;j<2;j++) { double base = pow(2.0,-0.25*(j+1.0)); -@@ -183,10 +183,10 @@ void init_layer3(int down_sample_sblimit +@@ -183,10 +183,10 @@ else p2 = pow(base,i*0.5); } @@ -111,7 +111,25 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } -@@ -608,7 +608,7 @@ static int pretab2[22] = {0,0,0,0,0,0,0, +@@ -354,7 +354,7 @@ + + if(gr_info->block_type == 0) { + fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); +- exit(1); ++ return; + } + + /* region_count/start parameters are implicit in this case. */ +@@ -434,7 +434,7 @@ + + if(gr_info->block_type == 0) { + fprintf(stderr,"Blocktype == 0 and window-switching == 1 not allowed.\n"); +- exit(1); ++ return; + } + /* region_count/start parameters are implicit in this case. */ + /* check this again! */ +@@ -608,7 +608,7 @@ * Dequantize samples (includes huffman decoding) */ /* 24 is enough because tab13 has max. a 19 bit huffvector */ @@ -120,7 +138,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ #define REFRESH_MASK \ while(num < BITSHIFT) { \ mask |= getbyte()<<(BITSHIFT-num); \ -@@ -625,7 +625,7 @@ static int III_dequantize_sample(real xr +@@ -625,7 +625,7 @@ int *me; int num=getbitoffset(); @@ -129,7 +147,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ part2remain -= num; { -@@ -709,50 +709,50 @@ static int III_dequantize_sample(real xr +@@ -709,50 +709,50 @@ if(x == 15 && h->linbits) { max[lwin] = cb; REFRESH_MASK; @@ -192,7 +210,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ xrpnt += step; } } -@@ -804,7 +804,7 @@ static int III_dequantize_sample(real xr +@@ -804,7 +804,7 @@ mask <<= 1; } else @@ -201,7 +219,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ xrpnt += step; } } -@@ -812,8 +812,8 @@ static int III_dequantize_sample(real xr +@@ -812,8 +812,8 @@ if(lwin < 3) { /* short band? */ while(1) { for(;mc > 0;mc--) { @@ -212,7 +230,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } if(m >= me) break; -@@ -883,50 +883,50 @@ static int III_dequantize_sample(real xr +@@ -883,50 +883,50 @@ if (x == 15 && h->linbits) { max = cb; REFRESH_MASK; @@ -275,7 +293,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } -@@ -974,7 +974,7 @@ static int III_dequantize_sample(real xr +@@ -974,7 +974,7 @@ mask <<= 1; } else @@ -284,7 +302,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } -@@ -987,7 +987,7 @@ static int III_dequantize_sample(real xr +@@ -987,7 +987,7 @@ num = 0; while(xrpnt < &xr[SBLIMIT][0]) @@ -293,7 +311,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ while( part2remain > 16 ) { getbits(16); /* Dismiss stuffing Bits */ -@@ -1065,8 +1065,8 @@ static void III_i_stereo(real xr_buf[2][ +@@ -1065,8 +1065,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for (; sb > 0; sb--,idx+=3) { real v = xr[0][idx]; @@ -304,7 +322,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } } -@@ -1087,8 +1087,8 @@ maybe still wrong??? (copy 12 to 13?) */ +@@ -1087,8 +1087,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx+=3 ) { real v = xr[0][idx]; @@ -315,7 +333,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } } /* end for(lwin; .. ; . ) */ -@@ -1108,8 +1108,8 @@ maybe still wrong??? (copy 12 to 13?) */ +@@ -1108,8 +1108,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; @@ -326,7 +344,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } else -@@ -1119,7 +1119,10 @@ maybe still wrong??? (copy 12 to 13?) */ +@@ -1119,7 +1119,10 @@ } else { /* ((gr_info->block_type != 2)) */ int sfb = gr_info->maxbandl; @@ -338,7 +356,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ for ( ; sfb<21; sfb++) { int sb = bi->longDiff[sfb]; is_p = scalefac[sfb]; /* scale: 0-15 */ -@@ -1128,8 +1131,8 @@ maybe still wrong??? (copy 12 to 13?) */ +@@ -1128,8 +1131,8 @@ t1 = tab1[is_p]; t2 = tab2[is_p]; for ( ; sb > 0; sb--,idx++) { real v = xr[0][idx]; @@ -349,7 +367,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } else -@@ -1143,8 +1146,8 @@ maybe still wrong??? (copy 12 to 13?) */ +@@ -1143,8 +1146,8 @@ for ( sb = bi->longDiff[21]; sb > 0; sb--,idx++ ) { real v = xr[0][idx]; @@ -360,7 +378,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } } /* ... */ -@@ -1177,8 +1180,8 @@ static void III_antialias(real xr[SBLIMI +@@ -1177,8 +1180,8 @@ for(ss=7;ss>=0;ss--) { /* upper and lower butterfly inputs */ register real bu = *--xr2,bd = *xr1; @@ -371,7 +389,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } } -@@ -1252,8 +1255,8 @@ static void dct36(real *inbuf,real *o1,r +@@ -1252,8 +1255,8 @@ { real t0, t1, t2; @@ -382,7 +400,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ t3 = in[0]; t2 = t3 - t1 - t1; -@@ -1261,16 +1264,16 @@ static void dct36(real *inbuf,real *o1,r +@@ -1261,16 +1264,16 @@ tmp[4] = t2 + t0 + t0; t3 += t1; @@ -403,7 +421,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ tmp[2] = tmp[6] = t3 - t0 - t2; tmp[0] = tmp[8] = t3 + t0 + t1; -@@ -1280,9 +1283,9 @@ static void dct36(real *inbuf,real *o1,r +@@ -1280,9 +1283,9 @@ { real t1, t2, t3; @@ -416,7 +434,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ { real t0 = t1 + t2 + t3; -@@ -1293,7 +1296,7 @@ static void dct36(real *inbuf,real *o1,r +@@ -1293,7 +1296,7 @@ t2 -= t3; t1 -= t3; @@ -425,7 +443,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ t1 += t3; tmp[3] += t1; -@@ -1308,35 +1311,35 @@ static void dct36(real *inbuf,real *o1,r +@@ -1308,35 +1311,35 @@ { real t0, t1, t2, t3, t4, t5, t6, t7; @@ -471,7 +489,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ tmp[5] = t3 - t2; t4 -= t1 + t7; -@@ -1351,53 +1354,53 @@ static void dct36(real *inbuf,real *o1,r +@@ -1351,53 +1354,53 @@ { real t0, t1, t2, t3, t4, t5, t6, t7; @@ -548,7 +566,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ { register real *out2 = o2; -@@ -1422,20 +1425,20 @@ static void dct36(real *inbuf,real *o1,r +@@ -1422,20 +1425,20 @@ #define MACRO0(v) { \ real tmp; \ @@ -575,7 +593,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO0(v); } register const real *c = COS9; -@@ -1446,17 +1449,17 @@ static void dct36(real *inbuf,real *o1,r +@@ -1446,17 +1449,17 @@ real ta33,ta66,tb33,tb66; @@ -601,7 +619,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO1(0); MACRO2(8); -@@ -1464,10 +1467,10 @@ static void dct36(real *inbuf,real *o1,r +@@ -1464,10 +1467,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; @@ -616,7 +634,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO1(1); MACRO2(7); -@@ -1475,10 +1478,10 @@ static void dct36(real *inbuf,real *o1,r +@@ -1475,10 +1478,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; @@ -631,7 +649,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO1(2); MACRO2(6); -@@ -1486,10 +1489,10 @@ static void dct36(real *inbuf,real *o1,r +@@ -1486,10 +1489,10 @@ { real tmp1a,tmp2a,tmp1b,tmp2b; @@ -646,7 +664,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO1(3); MACRO2(5); -@@ -1498,7 +1501,7 @@ static void dct36(real *inbuf,real *o1,r +@@ -1498,7 +1501,7 @@ { real sum0,sum1; sum0 = in[2*0+0] - in[2*2+0] + in[2*4+0] - in[2*6+0] + in[2*8+0]; @@ -655,7 +673,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ MACRO0(4); } } -@@ -1522,19 +1525,19 @@ static void dct12(real *in,real *rawout1 +@@ -1522,19 +1525,19 @@ \ in5 += in3; in3 += in1; \ \ @@ -681,7 +699,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ \ in3 = in4 + in5; \ in4 -= in5; \ -@@ -1554,27 +1557,27 @@ static void dct12(real *in,real *rawout1 +@@ -1554,27 +1557,27 @@ { real tmp0,tmp1 = (in0 - in4); { @@ -723,7 +741,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } in++; -@@ -1588,27 +1591,27 @@ static void dct12(real *in,real *rawout1 +@@ -1588,27 +1591,27 @@ { real tmp0,tmp1 = (in0 - in4); { @@ -765,7 +783,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } in++; -@@ -1623,27 +1626,27 @@ static void dct12(real *in,real *rawout1 +@@ -1623,27 +1626,27 @@ { real tmp0,tmp1 = (in0 - in4); { @@ -807,7 +825,7 @@ $NetBSD: patch-ai,v 1.4 2006/05/26 12:16:13 drochner Exp $ } } -@@ -1693,7 +1696,7 @@ static void III_hybrid(real fsIn[SBLIMIT +@@ -1693,7 +1696,7 @@ int i; for(i=0;i #endif @@ -11,3 +11,19 @@ $NetBSD: patch-av,v 1.1 2005/10/03 15:17:14 joerg Exp $ #if defined (USE_MMAP) && defined(MAP_ANONYMOUS) && !defined(MAP_ANON) #define MAP_ANON MAP_ANONYMOUS #endif +@@ -180,6 +178,15 @@ + if (FD_ISSET(fd, &selfds)) + switch (read(fd, &cmd, 1)) { + case 0: /* EOF */ ++ /* ++ * We should not check ++ * errno later on in ++ * this case, but we ++ * have to return an ++ * error code, so it ++ * will happen. ++ */ ++ errno = 0; + return (-1); + case -1: + if (errno == EINTR) -- cgit v1.2.3