Eeschema: ibis_parser - Fix undefined behavior due to pointer aliasing in isNumberNA

This commit is contained in:
kliment 2022-12-01 15:44:38 +00:00 committed by Mikolaj Wielgus
parent 1aa05c0e10
commit 0f09172902
1 changed files with 2 additions and 1 deletions

View File

@ -32,6 +32,7 @@
#include "ibis_parser.h"
#include <sstream>
#include <cstring> //for memcmp
#include <iterator>
#include <locale_io.h> // KiCad header
@ -134,7 +135,7 @@ bool IBIS_MATRIX_SPARSE::Check()
bool isNumberNA( double aNumber )
{
double NA = nan( NAN_NA );
return *reinterpret_cast<std::uint64_t*>(&aNumber) == *reinterpret_cast<std::uint64_t*>( &NA );
return std::memcmp( &aNumber, &NA, sizeof NA ) == 0;
}
bool TypMinMaxValue::Check()