Opened 10 years ago
Closed 9 years ago
#916 closed defect (fixed)
RasdlError class should not have errno member
Reported by: | Dimitar Misev | Owned by: | jzhang |
---|---|---|---|
Priority: | major | Milestone: | 9.1 |
Component: | rasdl | Version: | development |
Keywords: | Cc: | Peter Baumann | |
Complexity: | Medium |
Description
The class RasdlError (in rasdl_error.(hh|cc) has a member called "errno". In C++ errno is a macro reserved for error handling (see http://tinyurl.com/3uxzfls).
Since rasdl_error.cc/hh includes no standard headers the code compiles just fine. But when rasdl_error.hh is included in some file that already included standard headers the preprocessor transforms RasdlError into:
class RasdlError { public: RasdlError( unsigned int e ); virtual ~RasdlError(); virtual const char * what(); private: unsigned int (*__errno_location ()); };
So the class layout changes since unsigned int (*errno_location()); takes no space. Therefore all methods operating on errno are accessing memory that doesn´t belong to the object. This caused rasdl to crash when called with an unknown parameter (e.g. rasdl -g).
Changing the members name to error_code fixed the problem.
Change History (2)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |