shithub: opusfile

Download patch

ref: f4c72321ca1f7b9734a503d56ee4c38231299bfa
parent: 78e5fffc305fc44737983e94ea1f9cfd00042c94
author: Timothy B. Terriberry <[email protected]>
date: Thu Sep 20 15:12:46 EDT 2012

Fix crash in seeking_example.

When a match fails, the index of the position in the link needs to
 be 64 bits.

--- a/examples/seeking_example.c
+++ b/examples/seeking_example.c
@@ -164,15 +164,15 @@
   if(_bigassbuffer!=NULL){
     for(i=0;i<nsamples*nchannels;i++){
       if(!MATCH(buffer[i],_bigassbuffer[pcm_offset*nchannels+i])){
+        ogg_int64_t j;
         fprintf(stderr,"\nData after seek doesn't match declared PCM "
          "position: mismatch %G\n",
          (double)buffer[i]-_bigassbuffer[pcm_offset*nchannels+i]);
-        for(i=0;i<duration-nsamples;i++){
-          int j;
-          for(j=0;j<nsamples*nchannels;j++){
-            if(!MATCH(buffer[j],_bigassbuffer[i*nchannels+j]))break;
+        for(j=0;j<duration-nsamples;j++){
+          for(i=0;i<nsamples*nchannels;i++){
+            if(!MATCH(buffer[i],_bigassbuffer[j*nchannels+i]))break;
           }
-          if(j==nsamples*nchannels){
+          if(i==nsamples*nchannels){
             fprintf(stderr,"\nData after seek appears to match position %li.\n",
              (long)i);
           }