Skip to content

Concerning compilation warning in string_search.h #37145

Description

@targos

On Windows with MSVC, the implementation of StringSearch<Char>::BoyerMooreHorspoolSearch emits a concerning warning.

Code:

node/src/string_search.h

Lines 459 to 461 in fd02dac

const size_t pattern_length = pattern_.length();
int* char_occurrences = bad_char_shift_table_;
int64_t badness = -pattern_length;

The emitted warning is C4146: unary minus operator applied to unsigned type, result still unsigned

This looks like it introduces a bug in the function, at least on Windows, because badness is never going to be a negative number.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions