Skip to content

Conversation

@LeStarch
Copy link
Collaborator

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

Changing FwSignedSizeType in Os::File calls to FwSizeType to be in-line with other sizes in the system.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@LeStarch LeStarch force-pushed the issue-3285-reducing-signed-size-type-in-os-file branch from f268213 to aa79c5f Compare March 24, 2025 17:40
return this->m_delegate.seek(offset, seekType);
}

File::Status File::seek_absolute(FwSizeType offset) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

File::Status File::read(U8* buffer, FwSignedSizeType &size, File::WaitType wait) {
File::Status File::read(U8* buffer, FwSizeType &size, File::WaitType wait) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.


File::Status File::write(const U8* buffer, FwSignedSizeType &size, File::WaitType wait) {
File::Status File::write(const U8* buffer, FwSizeType &size, File::WaitType wait) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

File::Status File::incrementalCrc(FwSignedSizeType &size) {
File::Status File::incrementalCrc(FwSizeType &size) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

File::Status File::readline(U8* buffer, FwSignedSizeType &size, File::WaitType wait) {
const FwSignedSizeType requested_size = size;
File::Status File::readline(U8* buffer, FwSizeType &size, File::WaitType wait) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

FileSystem::Status FileSystem::getFileSize(const char* path, FwSignedSizeType& size) {
FileSystem::Status FileSystem::getFileSize(const char* path, FwSizeType& size) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
} // end handleFileError

FileSystem::Status FileSystem::copyFileData(File& source, File& destination, FwSignedSizeType size) {
FileSystem::Status FileSystem::copyFileData(File& source, File& destination, FwSizeType size) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

PosixFile::Status PosixFile::size(FwSignedSizeType& size_result) {
FwSignedSizeType current_position = 0;
PosixFile::Status PosixFile::size(FwSizeType& size_result) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

PosixFile::Status PosixFile::position(FwSignedSizeType& position_result) {
PosixFile::Status PosixFile::position(FwSizeType& position_result) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
}

PosixFile::Status PosixFile::preallocate(FwSignedSizeType offset, FwSignedSizeType length) {
PosixFile::Status PosixFile::preallocate(FwSizeType offset, FwSizeType length) {

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
@LeStarch LeStarch force-pushed the issue-3285-reducing-signed-size-type-in-os-file branch from 38b4ec8 to 795d993 Compare March 25, 2025 16:18
Copy link
Collaborator

@kevin-f-ortega kevin-f-ortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work!

File::Status File::readline(U8* buffer, FwSignedSizeType &size, File::WaitType wait) {
const FwSignedSizeType requested_size = size;
File::Status File::readline(U8* buffer, FwSizeType &size, File::WaitType wait) {
const FwSizeType requested_size = size;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter size has not been checked.
// Read hash from checksum file:
unsigned char savedHash[HASH_DIGEST_LENGTH];
FwSignedSizeType size = static_cast<FwSignedSizeType>(hashBuffer.getBuffCapacity());
FwSizeType size = static_cast<FwSizeType>(hashBuffer.getBuffCapacity());

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter hashBuffer has not been checked.

// Write out the hash
FwSignedSizeType size = static_cast<FwSignedSizeType>(hashBuffer.getBuffLength());
FwSizeType size = static_cast<FwSizeType>(hashBuffer.getBuffLength());

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter hashBuffer has not been checked.
{
FW_ASSERT((length > 0) and (length <= std::numeric_limits<FwSignedSizeType>::max()), static_cast<FwAssertArgType>(length));
FwSignedSizeType size = static_cast<FwSignedSizeType>(length);
FwSizeType size = length;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter length has not been checked.
)
{
FwSignedSizeType size = length;
FwSizeType size = length;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter length has not been checked.
}

FwSignedSizeType intSize = size;
FwSizeType intSize = size;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter size has not been checked.
}

FwSignedSizeType intLength = length;
FwSizeType intLength = length;

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter length has not been checked.

// Read checksum file
FwSignedSizeType checksum_from_file_size = static_cast<FwSignedSizeType>(sizeof(checksum_from_file));
FwSizeType checksum_from_file_size = static_cast<FwSizeType>(sizeof(checksum_from_file));

Check warning

Code scanning / CodeQL

Unchecked function argument Warning

This use of parameter checksum_from_file has not been checked.
@LeStarch LeStarch merged commit f912e1b into nasa:devel Mar 28, 2025
41 checks passed
thomas-bc pushed a commit to thomas-bc/fprime that referenced this pull request Apr 8, 2025
* Remove FwSignedSizeType from file

* Restoring FwSignedSizeType to seek offsets

* Fixing usages and UTs

* Fixes on Linux

* CI fix

* CI round 3

* CI rev 4

* Fixing code scan errors

* Review fixes - pt 1

* Failed to save
@LeStarch LeStarch deleted the issue-3285-reducing-signed-size-type-in-os-file branch August 19, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants