]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix error that caused seek format operations to set max file size to '1' or '0'
authorMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 18:27:44 +0000 (18:27 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 18:27:44 +0000 (18:27 +0000)
A very inappropriate placement of a ')' (introduced in r362151) caused the
maximum size of a file to be set as the result of a comparison operation, as
opposed to the result of the ftello operation.  This resulted in seeking being
restricted to the beginning of the file, or 1 byte into the file.  Thanks to
the Asterisk Test Suite for properly freaking out about this on at least one
test.

(issue ASTERISK-19655)
Reported by: Matt Jordan
........

Merged revisions 362304 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@362305 65c4cc65-6c06-0410-ace0-fbb531ad65f3

formats/format_g719.c
formats/format_gsm.c
formats/format_pcm.c
formats/format_siren14.c
formats/format_siren7.c
formats/format_sln.c
formats/format_vox.c
formats/format_wav.c
formats/format_wav_gsm.c

index 903fbcde9810b430c97724b4129bec7109693a19..0a0eea17039351b284047791403db95328b986af 100644 (file)
@@ -92,7 +92,7 @@ static int g719seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in g719 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index 4cf6579a607954be22afebbd52cdd98f92e6815a..26306806c2fe504ebe815ba50a89f42f8ffd1417 100644 (file)
@@ -120,7 +120,7 @@ static int gsm_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in g719 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index 2a740ef5d08cc26f6b4a2910ea51b128ee12817d..f65a6202f809f79e0be60343d767de5663c4eb37 100644 (file)
@@ -115,7 +115,7 @@ static int pcm_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in pcm filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
@@ -414,7 +414,7 @@ static int au_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in au filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index 08c2cbfbf7c10f21e70fadf5e2afd6c79794bbb7..f3e53e79556c11eb9e30a0a3375732949e5ec22f 100644 (file)
@@ -92,7 +92,7 @@ static int siren14seek(struct ast_filestream *fs, off_t sample_offset, int whenc
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in siren14 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index 955323ed263b74169207f7b084ad46caa68ec075..a07144bfc010a8be06d9866cbf8203a8d72abfcd 100644 (file)
@@ -92,7 +92,7 @@ static int siren7seek(struct ast_filestream *fs, off_t sample_offset, int whence
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in siren7 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index b90f6b27a277c5a84db280b03eaae0224596cb2c..982054459436b46c34d94d8720698e208080ba23 100644 (file)
@@ -86,7 +86,7 @@ static int slinear_seek(struct ast_filestream *fs, off_t sample_offset, int when
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in sln filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index bfa0d8e4cac6e55ccdac38b0ff3edb97c839f28a..3f3b1eabb326b596624ca31cf5fe6f41a646ec06 100644 (file)
@@ -90,7 +90,7 @@ static int vox_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in g719 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index df09db353a42b5a6d38f669a2242c3ff48b86df1..ca12ca47b77d8807c5256e4e57884a1f68905844 100644 (file)
@@ -468,7 +468,7 @@ static int wav_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
                return -1;
        }
 
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in wav filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index bbf3339bc0ad2c2aabfa2e61202b084df310db06..e4c5051a29aa1f4262e58747a30395a9817e49f3 100644 (file)
@@ -489,7 +489,7 @@ static int wav_seek(struct ast_filestream *fs, off_t sample_offset, int whence)
        }
 
        /* XXX ideally, should round correctly */
-       if ((max = ftello(fs->f) < 0)) {
+       if ((max = ftello(fs->f)) < 0) {
                ast_log(AST_LOG_WARNING, "Unable to determine max position in WAV filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }