]> 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:25:44 +0000 (18:25 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 17 Apr 2012 18:25:44 +0000 (18:25 +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

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@362304 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_sln16.c
formats/format_vox.c
formats/format_wav.c
formats/format_wav_gsm.c

index 692edad35b7f4b15dfc47804d5cb52727242efc4..81662d521a8de8c1d006dd351c393ae7c024f616 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 e7aa24e27fcb5e4c743d17bd0be9a32e3766caf7..a8b70e56e78f1aedb85140bbaf12a8d41bbe44c4 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 9dfdaa81242ad0dea8afb49ff46841d52bbcce61..4ff42f9626439c549226d967c3a51f751cbc6785 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 067de7692308def78b283d2be2397853a6299a76..e6cb3ec07142cc21298caccf234c0ab42a1f477f 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 3a6b3b39c64a5b5ec5b2d2168dec5123d250420a..1f361e1da2ae8febec7c8a862bda9450d4a37e6e 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 d6c18d688b3aa174cdd86cf8b32210ae288cb9c3..2a318f865597d010cbd144f1a3f1cc6a7963b995 100644 (file)
@@ -90,7 +90,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 4cc099057ef81b3f7731e31e6105775b935f0a50..1836fa5a26872b0189dd7b61f8e1001183e1b3cc 100644 (file)
@@ -92,7 +92,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 sln16 filestream %p: %s\n", fs, strerror(errno));
                return -1;
        }
index a60808a11d7ac07dfdbf6b665c09061c685bf040..3fd2504cb24722d7550964604e787fb00b0b3d3f 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 c5e47ed19b84d01b4ea59347fd0f80717c1c3140..f78ade4600d1a867963d04eb595f18a86159ec5e 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 7d0234fa26d0ab0bfa60031194f9f5fc008b89fe..4b13110d53de5a5a033c8f935d49fd0ee9a3dee8 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;
        }