Use signed arithmetic for indexes that can be negative
Bug: webrtc:15523
Change-Id: I41ea47a679242c8febe70373529173733058c479
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322120
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sergey Sukhanov <sergeysu@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40924}
Trying to calculate std::abs(min_int) results in an int overflow.
Original author: asmok@.
Bug: None
Change-Id: I984e9ba4f48411a583a55cc3f9c66c9a1cc8dc92
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318120
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40660}
This CL adds #includes to header files in order to make them
self contained after the preprocessor pass.
Bug: b/251890128
Change-Id: I81c3ba38fb8ab8a2bbd151ba99aa871fae9f1b1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/278422
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38327}
Finding the array element with the largest argmax is a fairly common
operation, so it makes sense to have a Neon optimized version. The
implementation is done by first finding both the min and max value, and
then returning whichever has the largest argmax.
Bug: chromium:12355
Change-Id: I088bd4f7d469b2424a7265de10fffb42764567a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/201622
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33052}
Prior to this commit, most .c files in modules/audio_coding/codecs/ilbc
don't include their corresponding headers, nor do they order #includes
as per the Google Style Guide [1]. The former is especially harmful,
since in C it can silently allow the function signature to diverge from
its prototype, thus causing disaster at runtime.
This CL fixes both issues. In effect, this allows the common_audio and
modules/audio_coding:ilbc targets to be compiled with Clang's
-Wmissing-prototypes, though this CL does not add that change.
[1]: https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes
Bug: webrtc:12314
Change-Id: I8299968ed3cc86ff35d9de045072b846298043af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/198362
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Timothy Gu <timothygu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#32896}
The last run-time logic for selecting function pointers was removed in
May 2016, here: https://codereview.webrtc.org/1955413003
It would be even better if we could eliminate the function pointers
entirely and just have different implementations that we select at
compile time; I've left a TODO asking for this.
Bug: webrtc:9553
Change-Id: Ica71d71e19759da00967168f6479b7eb8b46c590
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144053
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28414}
Semi-automatically created with:
git grep -l " testing::" | xargs sed -i "s/ testing::/ ::testing::/g"
git grep -l "(testing::" | xargs sed -i "s/(testing::/(::testing::/g"
git cl format
After this, two .cc files failed to compile and I have fixed them
manually.
Bug: webrtc:10523
Change-Id: I4741d3bcedc831b6c5fdc04485678617eb4ce031
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132018
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27526}
This CL replaces std::o?stringstream with rtc::StringBuilder where that's possible to do without changing any of the surrounding code. It also updates includes and build files as appropriate.
The CL was generated by running 'git grep -l -P std::o?stringstream | xargs perl -pi -e "s/std::o?stringstream/rtc::StringBuilder/g"'. Then I've manually updated the #includes and BUILD files, run 'git cl format' and unstaged any file that would need more complex fixes.
Bug: webrtc:8982
Change-Id: Ibc32153f4a3fd177e260b6ad05ce393972549357
Reviewed-on: https://webrtc-review.googlesource.com/98460
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24605}
This CL removes //build/config/clang:find_bad_constructs from the
suppressed_configs list, which means that clang:find_bad_constructs
is now enabled on these translation units.
Bug: webrtc:9251
Change-Id: I1607df2a3ad177e2f3023156eb8cf37857ae06ba
Reviewed-on: https://webrtc-review.googlesource.com/89041
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24002}
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}
Follow-up CL of https://webrtc-review.googlesource.com/c/src/+/69641
in which the 3pp lib openmax_dl had been disabled (but not removed).
Bug: webrtc:9071
Change-Id: Id766e4a48ab255a86e13f5f5f1480aee88c428a5
Reviewed-on: https://webrtc-review.googlesource.com/74482
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23140}
In this code, the problem was that the ptr could sometimes point
outside of the allocated arrays, in particular before the array,
causing a pointer overflow warning. However, the memory pointed to was
never read or written while the pointer was off.
With this change, we keep an index instead of a pointer, which avoids
warnings for pointer overflow. The index might be negative at times,
but the index will not be used to address the arrays while negative.
Bug: webrtc:9166
Change-Id: I3a32d8e814660f43be9d4c94889d00ac3f8403a5
Reviewed-on: https://webrtc-review.googlesource.com/71165
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22951}
This moves it from an API directory (system_wrappers/include/) to a
non-API directory, which is exactly what we want for utilities like
this.
Bug: webrtc:8445
NOPRESUBMIT=true
Change-Id: I30d01fcb9cbe1427a7703a3cdd7befae751066b5
Reviewed-on: https://webrtc-review.googlesource.com/21982
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22550}
We have done changes to the Audio Processing fuzzer here
https://webrtc-review.googlesource.com/c/src/+/36500/6.
We ran the new version of the fuzzer locally. The UBSAN
detector found these (minor) issues.
We have used the Godbolt compiler explorer to check that similar
changes produce identical compiled code.
Bug: webrtc:7820
Change-Id: I9cc3b81e4be7cf691f878c37010ce105bc2f3e38
Reviewed-on: https://webrtc-review.googlesource.com/39264
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21605}
Simply use int64_t instead of int32_t for two local variables.
This avoids integer-overflow in some rare cases.
Bug: chromium:784216
Change-Id: Ie96835d6dc04e338b157469b74ead29e8bd403dd
Reviewed-on: https://webrtc-review.googlesource.com/26580
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21141}
The fuzzer will hammer on the UpdateSid and Generate methods of
ComfortNoiseDecoder.
The change also includes a fix to an issue in WebRtcSpl_FilterAR, which
was immediately found by running the fuzzer locally.
Bug: none
Change-Id: I5283427cb27844fb953e2caa35423ea873aca2ff
Reviewed-on: https://webrtc-review.googlesource.com/28100
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21134}
Specifically, I'm moving
safe_compare.h
safe_conversions.h
safe_minmax.h
They shouldn't be part of the API, and moving them to an appropriate
subdirectory of rtc_base/ is a good way to keep track of that.
BUG=webrtc:8445
Change-Id: I458531aeb30bcf4291c4bec3bf22a2fffbf054ff
Reviewed-on: https://webrtc-review.googlesource.com/20860
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20829}
Issue was found by the Audio Processing fuzzer.
Bug: chromium:778939, chromium:778921, chromium:778919
Change-Id: If613cf4c533f546d118f10a6358cecd329958177
Reviewed-on: https://webrtc-review.googlesource.com/16161
Commit-Queue: Alex Loiko <aleloi@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20494}
This CL replaces 5 left shifts where the shifted value may be
negative. The shifts are replaced with equivalent multiplications.
Bug: chromium:777231, chromium:776719, chromium:776624, chromium:776286
Change-Id: Ifb27d5506eac779e60f238432bdf9e4bc5b2da4c
Reviewed-on: https://webrtc-review.googlesource.com/14800
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20430}
Now that we have moved WebRTC from src/webrtc to src/, common_types.h
and typedefs.h are triggering a cpplint error.
The cpplint complaint is:
Include the directory when naming .h files [build/include] [4]
This CL disables the error but we have to remove these two headers
from the root directory.
NOPRESUBMIT=true
Bug: webrtc:5876
Change-Id: I08e1b69aadcc4b28ab83bf25e3819d135d41d333
Reviewed-on: https://webrtc-review.googlesource.com/1577
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@google.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19859}
In https://webrtc-review.googlesource.com/c/src/+/1560 we moved WebRTC
from src/webrtc to src/ (in order to preserve an healthy git history).
This CL takes care of fixing header guards, #include paths, etc...
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iea91618212bee0af16aa3f05071eab8f93706578
Reviewed-on: https://webrtc-review.googlesource.com/1561
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19846}
In order to eliminate the WebRTC Subtree mirror in Chromium,
WebRTC is moving the content of the src/webrtc directory up
to the src/ directory.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
TBR=tommi@webrtc.org
Bug: chromium:611808
Change-Id: Iac59c5b51b950f174119565bac87955a7994bc38
Reviewed-on: https://webrtc-review.googlesource.com/1560
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Kjellander <kjellander@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19845}