summaryrefslogtreecommitdiff
path: root/src/common/util.c
AgeCommit message (Collapse)Author
2017-07-26Suppress clang4-specific -Wdouble-promotion warningsNick Mathewson
Wow, it sure seems like some compilers can't implement isnan() and friends in a way that pleases themselves! Fixes bug 22915. Bug trigged by 0.2.8.1-alpha and later; caused by clang 4.
2017-07-05Only disable -Wfloat-conversion on mingw when it exists.Nick Mathewson
The 22081 fix disabled -Wfloat-conversion, but -Wfloat-conversion didn't exist in every relevant mingw; it was added in GCC 4.9.x some time, if the documentation can be trusted. Bug not in any released version of tor.
2017-07-05Merge branch 'bug22801_028' into maint-0.2.9Nick Mathewson
2017-07-03Fix -Wfloat-conversion C warnings on mingw in clamp_double_to_int64.Nick Mathewson
We just have to suppress these warnings: Mingw's math.h uses gcc's __builtin_choose_expr() facility to declare isnan, isfinite, and signbit. But as implemented in at least some versions of gcc, __builtin_choose_expr() can generate type warnings even from branches that are not taken. Fixes bug 22801; bugfix on 0.2.8.1-alpha.
2016-11-02Improve comments in check_private_dir and onion poisoningteor
Comment changes only
2016-10-14Merge remote-tracking branch 'public/spaces_in_unix_addrs'Nick Mathewson
2016-10-11torrc parsing b0rks on carriage-returnpaolo.ingls@gmail.com
(Specifically, carriage return after a quoted value in a config line. Fixes bug 19167; bugfix on 0.2.0.16-alpha when we introduced support for quoted values. Unit tests, changes file, and this parenthetical by nickm.)
2016-10-04Allow a unix: address to contain a C-style quoted string.Nick Mathewson
Feature 18753 -- all this to allow spaces.
2016-09-11Merge remote-tracking branch 'public/solaris_warnings_028'Nick Mathewson
2016-09-06checkSpace.pl now forbids more identifiers.Nick Mathewson
The functions it warns about are: assert, memcmp, strcat, strcpy, sprintf, malloc, free, realloc, strdup, strndup, calloc. Also, fix a few lingering instances of these in the code. Use other conventions to indicate _intended_ use of assert and malloc/realloc/etc.
2016-07-28Three more -Wshadow fixes.Nick Mathewson
2016-07-28Fix a large pile of solaris warnings for bug 19767.Nick Mathewson
In nearly all cases, this is a matter of making sure that we include orconfig.h before we include any standard c headers.
2016-07-28Fix a huge pile of -Wshadow warnings.Nick Mathewson
These appeared on some of the Jenkins platforms. Apparently some GCCs care when you shadow globals, and some don't.
2016-07-28Merge branch 'bug18902_squashed'Nick Mathewson
2016-07-28Fix all -Wshadow warnings on LinuxNick Mathewson
This is a partial fix for 18902.
2016-07-26Add a function to simplify a fraction.Nick Mathewson
Apparently remembering euclid's algorithm does pay off sooner or later.
2016-07-26Tweaks on 19435 fix:Nick Mathewson
* Raise limit: 16k isn't all that high. * Don't log when limit exceded; log later on. * Say "over" when we log more than we say we log. * Add target version to changes file
2016-07-26Fix integer overflow in the rate-limiter (#19435).Ivan Markin
2016-07-05Fix a variable-shadowing bug in check_private_dirNick Mathewson
We introduded a shadowed variable, thereby causing a log message to be wrong. Fixes 19578. I believe the bug was introduced by 54d7d31cba84232 in 0.2.2.29-beta.
2016-07-01Merge remote-tracking branch 'dgoulet/ticket16943_029_05-squashed'Nick Mathewson
Trivial Conflicts: src/or/or.h src/or/routerparse.c
2016-06-30Merge remote-tracking branch 'andrea/bug18322_v3_squashed'Nick Mathewson
2016-06-30Make things mockable for dump_desc_populate_fifo_from_directory() unit testAndrea Shepard
2016-06-30Unit test for dump_desc_populate_one_file()Andrea Shepard
2016-06-30Move unparseable descriptor dumps into subdirectory of DataDirAndrea Shepard
2016-06-30Expose dump_desc() to the test suite and make things it calls mockableAndrea Shepard
2016-06-30Fix bug19483: avoid range checks when they are always trueteor (Tim Wilson-Brown)
Some compilers are smart enough to work out that comparisons to LONG_MAX are a no-op on L64.
2016-06-29Improve overflow checks in tv_udiff and tv_mdiffteor (Tim Wilson-Brown)
Validate that tv_usec inputs to tv_udiff and tv_mdiff are in range. Do internal calculations in tv_udiff and tv_mdiff in 64-bit, which makes the function less prone to integer overflow, particularly on platforms where long and time_t are 32-bit, but tv_sec is 64-bit, like some BSD configurations. Check every addition and subtraction that could overflow.
2016-06-29Fix an integer overflow bug in the tv_mdiff range checkteor (Tim Wilson-Brown)
The temporary second used for rounding can cause overflow, depending on the order the compiler performs the operations.
2016-06-20Add tor_htonll/ntohll functionsDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2016-06-19Changes file for 19063; use the BUG macroNick Mathewson
2016-06-19Fix #19063: Add check in utility macroU+039b
2016-06-17Use the Autoconf macro AC_USE_SYSTEM_EXTENSIONScypherpunks
The Autoconf macro AC_USE_SYSTEM_EXTENSIONS defines preprocessor macros which turn on extensions to C and POSIX. The macro also makes it easier for developers to use the extensions without needing (or forgetting) to define them manually. The macro can be safely used because it was introduced in Autoconf 2.60 and Tor requires Autoconf 2.63 and above.
2016-06-16Mark an abort() as unreachable.Nick Mathewson
2016-06-16Mark code unreachable in unescape_string()Nick Mathewson
Also, add tests for it in case someday it does become reachable.
2016-06-16Tests for message rate-limitingNick Mathewson
Also note a bug in the rate-limiting message.
2016-06-16I believe I found some dead code in our time parsing functionsNick Mathewson
2016-06-16tests for size_mul_check__()Nick Mathewson
it's important, and we should make sure we got it right.
2016-06-16Correct the rounding behavior on tv_mdiff.Nick Mathewson
Fix for bug 19428.
2016-06-16add LCOV_EXCL for unreachable exit() blocks in src/commonNick Mathewson
2016-06-15Mark src/common tor_assert(0)/tor_fragile_assert() unreached for coverageNick Mathewson
I audited this to make sure I was only marking ones that really should be unreachable.
2016-06-11Add -Wfloat-conversion for GCC >= 4.9Nick Mathewson
This caught quite a few minor issues in our unit tests and elsewhere in our code.
2016-05-27Enable the -Waggregate-return warningNick Mathewson
Suppress it in the one spot in the code where we actually do want to allow an aggregate return in order to call the mallinfo() API.
2016-05-19Remove round_int64_to_next_multiple_of: It is now unused.Nick Mathewson
2016-05-12Merge branch 'maint-0.2.8'Nick Mathewson
2016-05-12Merge branch 'maint-0.2.7' into maint-0.2.8Nick Mathewson
2016-05-12Merge branch 'bug18977_026_v2' into maint-0.2.7Nick Mathewson
2016-05-12Fix a compiler warning on windows when sizeof(long)==sizeof(int)Nick Mathewson
2016-05-12Merge branch 'bug18977_024_v2' into bug18977_026_v2Nick Mathewson
Had conflicts related to other correct_tm bugs in 0.2.6. Added wday for another case.
2016-05-12Have correct_tm set tm_wday as well.Nick Mathewson
The tm_wday field had been left uninitialized, which was causing some assertions to fail on Windows unit tests. Fixes bug 18977.
2016-05-12Use a much less clever scan_signed no-overflow hackNick Mathewson