Skip to content

Conversation

@bneradt
Copy link
Contributor

@bneradt bneradt commented Jan 13, 2022

gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
477 | if (new_param && (new_param + 1)) {
| ~~~~~~~~~~~^~~~

That is indeed a bug. new_param + 1 will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.

gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
  477 |       if (new_param && (new_param + 1)) {
      |                        ~~~~~~~~~~~^~~~

That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.
@bneradt bneradt requested a review from zwoop as a code owner January 13, 2022 16:26
@bneradt bneradt self-assigned this Jan 13, 2022
@bneradt bneradt merged commit 9966c9b into apache:master Jan 13, 2022
@bneradt bneradt deleted the build_with_gcc_12 branch January 13, 2022 21:03
@bneradt bneradt added this to the 10.0.0 milestone Jan 16, 2022
zwoop pushed a commit that referenced this pull request Jan 18, 2022
gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
  477 |       if (new_param && (new_param + 1)) {
      |                        ~~~~~~~~~~~^~~~

That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.

(cherry picked from commit 9966c9b)
@zwoop
Copy link
Contributor

zwoop commented Jan 18, 2022

Cherry-picked to v9.2.x

@zwoop zwoop modified the milestones: 10.0.0, 9.2.0 Jan 18, 2022
moonchen pushed a commit to moonchen/trafficserver that referenced this pull request Mar 17, 2022
* asf/9.2.x:
  Updated ChangeLog
  TSHttpTxnCacheLookupStatusGet: handle cannot respond cases (apache#8545)
  Update to Proxy Verifier version v2.3.0 (apache#8608)
  Don't use Http1ClientTransaction as an event handler (apache#8609)
  Eliminate erroneous self-loop error on transparent mode (apache#8586)
  Clean up of next hop HostRecord class. (apache#8585)
  Propagate accept options to HTTP/2 (apache#8594)
  add --with-mimalloc option (apache#8233)
  Fix transparent mode documentation (apache#8593)
  Docs: Slack instead of irc (apache#8599)
  LogFilter: fix NULL termination check (apache#8603)
  Fixes a scoping bug that leads to "sticky" weights (apache#8606)
@ywkaras ywkaras modified the milestones: 9.2.0, 9.1.2 Jun 2, 2022
@ywkaras
Copy link
Contributor

ywkaras commented Jun 2, 2022

@zwoop or whoever's doing 9.1.x releases, we need this for 9.1.x to build on Fedora. Or is 9.1.x deprecated in favor of 9.2.x?

https://ci.trafficserver.apache.org/job/Github_Builds/job/fedora/997/console

ywkaras pushed a commit to ywkaras/trafficserver that referenced this pull request Jun 15, 2022
gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
  477 |       if (new_param && (new_param + 1)) {
      |                        ~~~~~~~~~~~^~~~

That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.
bneradt added a commit to bneradt/trafficserver that referenced this pull request Oct 11, 2022
gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
  477 |       if (new_param && (new_param + 1)) {
      |                        ~~~~~~~~~~~^~~~

That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.

(cherry picked from commit 9966c9b)
bryancall pushed a commit that referenced this pull request Oct 11, 2022
* Fix Clang 13.0.1 and GCC 12.0.1 Compiler Warnings (#8690)

This cherry-picks two commits from master:

Fix Clang 13.0.1 compiler warnings (#8685)

This fixes a couple compiler warnings raised by Clang 13.0.1.

(cherry picked from commit 96ce993)

Fix warnings from GCC 12.0.1 (#8684)

This patch fixes warnings generated by GCC 12.0.1. The warnings involved the
use of the deprecated std::binary_function, std::unary_function, and
std::iterator interfaces. The use of these was considered more confusing than
explicitly declaring the associated types. Therefore this patch replaces the
use of these deprecated interfaces with the declaration of the associated
types.

(cherry picked from commit 0ae34d4)
(cherry picked from commit 1a37ae9)

* LogFilter: fix NULL termination check (#8603)

gcc-12 generated the following warning:

proxy/logging/LogFilter.h: In function 'void wipeField(char**, char*, const char*)':
proxy/logging/LogFilter.h:477:35: error: comparing the result of pointer addition '(new_param + 1)' and NULL [-Werror=address]
  477 |       if (new_param && (new_param + 1)) {
      |                        ~~~~~~~~~~~^~~~

That is indeed a bug. `new_param + 1` will always be non-NULL even if new_param
is NULL because 1 will be added to it. The intention was to check for the
string's null terminator at the offset, which is done via a dereference.

(cherry picked from commit 9966c9b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants