Skip to content

Commit bee8a22

Browse files
committed
chore(codeql): address pre-existing CodeQL alerts #5243
Fix errors: duplicate include guard, null checks, default parameter, tautological comparisons, redundant operator=, virtual calls from ctor/dtor. Fix warnings: comparison always same, Rule of Two, enum casts. Fix notices: remove commented-out code, rename shadowing variables, simplify complex condition, fix Q-encoding bounds check. Suppress false positives: auth-bypass, cleartext-transmission, XXE, local-address-stored, float-equality, raw-array-interface.
1 parent 61cc38f commit bee8a22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+113
-238
lines changed

Data/src/Row.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ bool Row::operator < (const Row& other) const
307307
if (_values[it->get<0>()].convert<double>() <
308308
other._values[it->get<0>()].convert<double>())
309309
return true;
310+
// CodeQL [cpp/float-equality]: intentional exact comparison in dynamic type system
310311
else if (_values[it->get<0>()].convert<double>() !=
311312
other._values[it->get<0>()].convert<double>())
312313
return false;

Data/src/SQLChannel.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ void SQLChannel::run()
258258
{
259259
try
260260
{
261-
sleepTime = 100;
262261
if (_reconnect)
263262
{
264263
close();

Data/testsuite/src/Extractor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class Extractor: public Poco::Data::AbstractExtractor
419419
bool extract(std::size_t pos, Poco::Nullable<UUID>& val) override;
420420
/// Extracts a Nullable<UUID>.
421421

422-
bool isNull(std::size_t col, std::size_t row = -1) override;
422+
bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) override;
423423
/// Returns true if the current row value at pos column is null.
424424

425425
void reset() override;

Foundation/include/Poco/Dynamic/Var.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,7 @@ inline bool operator == (const float& other, const Var& da)
18591859
/// Equality operator for comparing Var with float
18601860
{
18611861
if (da.isEmpty()) return false;
1862+
// CodeQL [cpp/float-equality]: intentional exact comparison in dynamic type system
18621863
return other == da.convert<float>();
18631864
}
18641865

@@ -1867,6 +1868,7 @@ inline bool operator != (const float& other, const Var& da)
18671868
/// Inequality operator for comparing Var with float
18681869
{
18691870
if (da.isEmpty()) return true;
1871+
// CodeQL [cpp/float-equality]: intentional exact comparison in dynamic type system
18701872
return other != da.convert<float>();
18711873
}
18721874

@@ -1963,6 +1965,7 @@ inline bool operator == (const double& other, const Var& da)
19631965
/// Equality operator for comparing Var with double
19641966
{
19651967
if (da.isEmpty()) return false;
1968+
// CodeQL [cpp/float-equality]: intentional exact comparison in dynamic type system
19661969
return other == da.convert<double>();
19671970
}
19681971

@@ -1971,6 +1974,7 @@ inline bool operator != (const double& other, const Var& da)
19711974
/// Inequality operator for comparing Var with double
19721975
{
19731976
if (da.isEmpty()) return true;
1977+
// CodeQL [cpp/float-equality]: intentional exact comparison in dynamic type system
19741978
return other != da.convert<double>();
19751979
}
19761980

Foundation/src/SplitterChannel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SplitterChannel::~SplitterChannel()
2929
{
3030
try
3131
{
32-
close();
32+
SplitterChannel::close();
3333
}
3434
catch (...)
3535
{

Foundation/src/Var.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,4 @@ std::string Var::toString(const Var& any)
622622
return res;
623623
}
624624

625-
/*
626-
Var& Var::structIndexOperator(VarHolderImpl<Struct<int>>* pStr, int n) const
627-
{
628-
return pStr->operator[](n);
629-
}
630-
*/
631-
632625
} } // namespace Poco::Dynamic

Foundation/src/VarIterator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "Poco/Dynamic/VarIterator.h"
1616
#include "Poco/Dynamic/Var.h"
17-
//#include "Poco/Dynamic/Struct.h"
1817
#undef min
1918
#undef max
2019
#include <limits>

JSON/include/Poco/JSON/Object.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,19 +607,16 @@ class VarHolderImpl<JSON::Object::Ptr>: public VarHolder
607607

608608
void convert(DateTime& /*val*/) const override
609609
{
610-
//TODO: val = _val;
611610
throw NotImplementedException("Conversion not implemented: JSON:Object => DateTime");
612611
}
613612

614613
void convert(LocalDateTime& /*ldt*/) const override
615614
{
616-
//TODO: ldt = _val.timestamp();
617615
throw NotImplementedException("Conversion not implemented: JSON:Object => LocalDateTime");
618616
}
619617

620618
void convert(Timestamp& /*ts*/) const override
621619
{
622-
//TODO: ts = _val.timestamp();
623620
throw NotImplementedException("Conversion not implemented: JSON:Object => Timestamp");
624621
}
625622

@@ -747,19 +744,16 @@ class VarHolderImpl<JSON::Object>: public VarHolder
747744

748745
void convert(DateTime& /*val*/) const override
749746
{
750-
//TODO: val = _val;
751747
throw NotImplementedException("Conversion not implemented: JSON:Object => DateTime");
752748
}
753749

754750
void convert(LocalDateTime& /*ldt*/) const override
755751
{
756-
//TODO: ldt = _val.timestamp();
757752
throw NotImplementedException("Conversion not implemented: JSON:Object => LocalDateTime");
758753
}
759754

760755
void convert(Timestamp& /*ts*/) const override
761756
{
762-
//TODO: ts = _val.timestamp();
763757
throw NotImplementedException("Conversion not implemented: JSON:Object => Timestamp");
764758
}
765759

JSON/include/Poco/JSON/Parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ class JSON_API Parser: private ParserImpl
119119
/// Returns the Handler.
120120

121121
Dynamic::Var asVar() const;
122-
/// Returns the result of parsing;
122+
/// Returns the result of parsing
123123

124124
Dynamic::Var result() const;
125-
/// Returns the result of parsing as Dynamic::Var;
125+
/// Returns the result of parsing as Dynamic::Var
126126

127127
private:
128128
Parser(const Parser&);

JSON/include/Poco/JSON/ParserImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ class JSON_API ParserImpl
8282
/// Returns the Handler.
8383

8484
Dynamic::Var asVarImpl() const;
85-
/// Returns the result of parsing;
85+
/// Returns the result of parsing
8686

8787
Dynamic::Var resultImpl() const;
88-
/// Returns the result of parsing as Dynamic::Var;
88+
/// Returns the result of parsing as Dynamic::Var
8989

9090
private:
9191
ParserImpl(const ParserImpl&);

0 commit comments

Comments
 (0)