Fix version number

This commit is contained in:
2025-07-01 10:39:48 +02:00
parent 4d6cad8f08
commit 81f2e706d0
2 changed files with 82 additions and 54 deletions

View File

@@ -63,7 +63,7 @@ struct ArffSummary {
* // Thread 2: globalArff.load("file2.arff"); // UNSAFE! * // Thread 2: globalArff.load("file2.arff"); // UNSAFE!
*/ */
class ArffFiles { class ArffFiles {
const std::string VERSION = "1.1.0"; const std::string VERSION = "1.2.0";
// Memory usage limits (configurable via environment variables) // Memory usage limits (configurable via environment variables)
static constexpr size_t DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100 MB static constexpr size_t DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100 MB
@@ -256,7 +256,8 @@ public:
private: private:
// Helper function to validate file path for security // Helper function to validate file path for security
static void validateFilePath(const std::string& fileName) { static void validateFilePath(const std::string& fileName)
{
if (fileName.empty()) { if (fileName.empty()) {
throw std::invalid_argument("File path cannot be empty"); throw std::invalid_argument("File path cannot be empty");
} }
@@ -298,14 +299,16 @@ private:
throw std::invalid_argument("Path traversal detected after normalization: " + normalizedStr); throw std::invalid_argument("Path traversal detected after normalization: " + normalizedStr);
} }
} }
} catch (const std::filesystem::filesystem_error& e) { }
catch (const std::filesystem::filesystem_error& e) {
// If filesystem operations fail, we can still proceed with basic validation // If filesystem operations fail, we can still proceed with basic validation
// This ensures compatibility with systems where filesystem might not be fully available // This ensures compatibility with systems where filesystem might not be fully available
} }
} }
// Helper function to validate resource usage limits // Helper function to validate resource usage limits
static void validateResourceLimits(const std::string& fileName, size_t sampleCount = 0, size_t featureCount = 0) { static void validateResourceLimits(const std::string& fileName, size_t sampleCount = 0, size_t featureCount = 0)
{
// Check file size limit // Check file size limit
try { try {
if (std::filesystem::exists(fileName)) { if (std::filesystem::exists(fileName)) {
@@ -314,7 +317,8 @@ private:
throw std::invalid_argument("File size (" + std::to_string(fileSize) + " bytes) exceeds maximum allowed size (" + std::to_string(DEFAULT_MAX_FILE_SIZE) + " bytes)"); throw std::invalid_argument("File size (" + std::to_string(fileSize) + " bytes) exceeds maximum allowed size (" + std::to_string(DEFAULT_MAX_FILE_SIZE) + " bytes)");
} }
} }
} catch (const std::filesystem::filesystem_error&) { }
catch (const std::filesystem::filesystem_error&) {
// If filesystem operations fail, continue without size checking // If filesystem operations fail, continue without size checking
// This ensures compatibility with systems where filesystem might not be available // This ensures compatibility with systems where filesystem might not be available
} }
@@ -622,11 +626,12 @@ private:
// Common helper function to parse ARFF file attributes and count samples // Common helper function to parse ARFF file attributes and count samples
static int parseArffFile(const std::string& fileName, static int parseArffFile(const std::string& fileName,
std::vector<std::pair<std::string, std::string>>& attributes, std::vector<std::pair<std::string, std::string>>& attributes,
std::set<std::string>& uniqueClasses, std::set<std::string>& uniqueClasses,
size_t& sampleCount, size_t& sampleCount,
int classIndex = -1, int classIndex = -1,
const std::string& classNameToFind = "") { const std::string& classNameToFind = "")
{
// Validate file path for security // Validate file path for security
validateFilePath(fileName); validateFilePath(fileName);

View File

@@ -6,9 +6,7 @@ from conan.tools.files import copy
class ArffFilesConan(ConanFile): class ArffFilesConan(ConanFile):
name = "arff-files" name = "arff-files"
version = "X.X.X" version = "X.X.X"
description = ( description = "Header-only library to read ARFF (Attribute-Relation File Format) files and return STL vectors with the data read."
"Header-only library to read ARFF (Attribute-Relation File Format) files and return STL vectors with the data read."
)
url = "https://github.com/rmontanana/ArffFiles" url = "https://github.com/rmontanana/ArffFiles"
license = "MIT" license = "MIT"
homepage = "https://github.com/rmontanana/ArffFiles" homepage = "https://github.com/rmontanana/ArffFiles"
@@ -30,10 +28,35 @@ class ArffFilesConan(ConanFile):
def package(self): def package(self):
# Copy header file to include directory # Copy header file to include directory
copy(self, "*.hpp", src=self.source_folder, dst=self.package_folder, keep_path=False) copy(
self,
"*.hpp",
src=self.source_folder,
dst=self.package_folder,
keep_path=False,
)
# Copy license and readme for package documentation # Copy license and readme for package documentation
copy(self, "LICENSE", src=self.source_folder, dst=self.package_folder, keep_path=False) copy(
copy(self, "README.md", src=self.source_folder, dst=self.package_folder, keep_path=False) self,
"LICENSE",
src=self.source_folder,
dst=self.package_folder,
keep_path=False,
)
copy(
self,
"README.md",
src=self.source_folder,
dst=self.package_folder,
keep_path=False,
)
copy(
self,
"CMakeLists.txt",
src=self.source_folder,
dst=self.package_folder,
keep_path=False,
)
def package_info(self): def package_info(self):
# Header-only library configuration # Header-only library configuration