diff --git a/cpp/src/io/comp/cpu_unbz2.cpp b/cpp/src/io/comp/cpu_unbz2.cpp index a116335b254..44535cff589 100644 --- a/cpp/src/io/comp/cpu_unbz2.cpp +++ b/cpp/src/io/comp/cpu_unbz2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2023, NVIDIA CORPORATION. + * Copyright (c) 2018-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ int32_t bz2_decompress_block(unbz_state_s* s) if (getbits(s, 1)) return BZ_DATA_ERROR; // blockRandomized not supported (old bzip versions) s->origPtr = getbits(s, 24); - if (s->origPtr < 0 || s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR; + if (s->origPtr > 10 + 100000 * s->blockSize100k) return BZ_DATA_ERROR; // Receive the mapping table inUse16 = getbits(s, 16); @@ -436,7 +436,7 @@ int32_t bz2_decompress_block(unbz_state_s* s) } // Now we know what nblock is, we can do a better sanity check on s->origPtr. - if (s->origPtr < 0 || s->origPtr >= nblock) return BZ_DATA_ERROR; + if (s->origPtr >= nblock) return BZ_DATA_ERROR; // compute the T^(-1) vector { diff --git a/cpp/src/io/parquet/reader_impl_helpers.cpp b/cpp/src/io/parquet/reader_impl_helpers.cpp index 402ccef7a15..c7659be1adb 100644 --- a/cpp/src/io/parquet/reader_impl_helpers.cpp +++ b/cpp/src/io/parquet/reader_impl_helpers.cpp @@ -205,7 +205,6 @@ void metadata::sanitize_schema() // This code attempts to make this less messy for the code that follows. std::function process = [&](size_t schema_idx) -> void { - if (schema_idx < 0) { return; } auto& schema_elem = schema[schema_idx]; if (schema_idx != 0 && schema_elem.type == UNDEFINED_TYPE) { auto const parent_type = schema[schema_elem.parent_idx].converted_type; @@ -723,7 +722,6 @@ aggregate_reader_metadata::select_columns(std::optional int schema_idx, std::vector& out_col_array, bool has_list_parent) { - if (schema_idx < 0) { return false; } auto const& schema_elem = get_schema(schema_idx); // if schema_elem is a stub then it does not exist in the column_name_info and column_buffer