Module: sems Branch: master Commit: 5e3fa5c32075feb65cddbf347914e5525baf88e0 URL: https://github.com/sems-server/sems/commit/5e3fa5c32075feb65cddbf347914e5525baf88e0
Author: Juha Heinanen <[email protected]> Committer: Juha Heinanen <[email protected]> Date: 2015-05-02T16:43:11+03:00 core: prevent integer overflow when computing file length - patch provided by Alessandro Rovetto --- Modified: core/AmAudioFile.cpp --- Diff: https://github.com/sems-server/sems/commit/5e3fa5c32075feb65cddbf347914e5525baf88e0.diff Patch: https://github.com/sems-server/sems/commit/5e3fa5c32075feb65cddbf347914e5525baf88e0.patch --- diff --git a/core/AmAudioFile.cpp b/core/AmAudioFile.cpp index 6f7c9f3..62efb62 100644 --- a/core/AmAudioFile.cpp +++ b/core/AmAudioFile.cpp @@ -438,7 +438,6 @@ int AmAudioFile::getLength() if (!data_size || !fmt.get()) return 0; - return - fmt->bytes2samples(data_size)*1000 - / fmt->getRate(); + float rate = fmt->getRate() / 1000; + return (int) (fmt->bytes2samples(data_size) / rate); } _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
