Skip to content

Commit

Permalink
swq_select::expand_wildcard(): avoid unsigned integer overflow, and c…
Browse files Browse the repository at this point in the history
…overity warning about loop taken once
  • Loading branch information
rouault committed Mar 12, 2024
1 parent a8846d1 commit c24b95c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ogr/swq_select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,13 +866,14 @@ CPLErr swq_select::expand_wildcard(swq_field_list *field_list,
column_defs.insert(pos, expanded_columns.begin(),
expanded_columns.end());

columns_added += static_cast<int>(expanded_columns.size() - 1);
columns_added += static_cast<int>(expanded_columns.size()) - 1;

auto it = m_exclude_fields.find(isrc);
const auto it = m_exclude_fields.find(isrc);
if (it != m_exclude_fields.end())
{
for (const auto &field : it->second)
if (!it->second.empty())
{
const auto &field = it->second.front();
CPLError(
CE_Failure, CPLE_AppDefined,
"Field %s specified in EXCEPT/EXCLUDE expression not found",
Expand Down

0 comments on commit c24b95c

Please sign in to comment.