Archived issue #0031925
Foundation Classes, OSD_Host::InternetAddress() - possible NULL dereference on copying gethostbyname() result
Description
> When writing a STEP AP203 file, the fallback value for the organization is the computer's IP address.
> This function segfaults, because gethostbyname returns a null pointer.
> OS: Linux 5.8.16
https://old.opencascade.com/content/segfault-osdhostinternetaddress#comment-21811
Backtrace:
> This function segfaults, because gethostbyname returns a null pointer.
> OS: Linux 5.8.16
https://old.opencascade.com/content/segfault-osdhostinternetaddress#comment-21811
Backtrace:
#0 0x00007ffff6e937bd in OSD_Host::InternetAddress() () from /usr/lib/libTKernel.so.7 #0000001 0x00007ffff3c26d07 in STEPConstruct_AP203Context::DefaultPersonAndOrganization() () from /usr/lib/libTKSTEP.so.7 #0000002 0x00007ffff3c2950e in STEPConstruct_AP203Context::InitPart(STEPConstruct_Part const&) () from /usr/lib/libTKSTEP.so.7 #3 0x00007ffff3c2e20f in STEPConstruct_ContextTool::GetRootsForPart(STEPConstruct_Part const&) () from /usr/lib/libTKSTEP.so.7 #4 0x00007ffff3cb62c6 in STEPControl_ActorWrite::Transfer(opencascade::handle<Transfer_Finder> const&, opencascade::handle<Transfer_FinderProcess> const&) () from /usr/lib/libTKSTEP.so.7 #5 0x00007ffff3467d2b in Transfer_ActorOfFinderProcess::Transferring(opencascade::handle<Transfer_Finder> const&, opencascade::handle<Transfer_ProcessForFinder> const&) () from /usr/lib/libTKXSBase.so.7 #6 0x00007ffff3470329 in Transfer_ProcessForFinder::TransferProduct(opencascade::handle<Transfer_Finder> const&) () from /usr/lib/libTKXSBase.so.7 #0000007 0x00007ffff3473d3c in Transfer_ProcessForFinder::Transferring(opencascade::handle<Transfer_Finder> const&) () from /usr/lib/libTKXSBase.so.7 #0000008 0x00007ffff3474167 in Transfer_ProcessForFinder::Transfer(opencascade::handle<Transfer_Finder> const&) () from /usr/lib/libTKXSBase.so.7 #0000009 0x00007ffff34e956f in ?? () from /usr/lib/libTKXSBase.so.7 #10 0x00007ffff34e98d8 in XSControl_Controller::TransferWriteShape(TopoDS_Shape const&, opencascade::handle<Transfer_FinderProcess> const&, opencascade::handle<Interface_InterfaceModel> const&, int) const () from /usr/lib/libTKXSBase.so.7 #0000011 0x00007ffff3cba9ad in STEPControl_Controller::TransferWriteShape(TopoDS_Shape const&, opencascade::handle<Transfer_FinderProcess> const&, opencascade::handle<Interface_InterfaceModel> const&, int) const () from /usr/lib/libTKSTEP.so.7 #12 0x00007ffff35028b5 in XSControl_TransferWriter::TransferWriteShape(opencascade::handle<Interface_InterfaceModel> const&, TopoDS_Shape const&) () from /usr/lib/libTKXSBase.so.7 #0000013 0x00007ffff350b80f in XSControl_WorkSession::TransferWriteShape(TopoDS_Shape const&, bool) () from /usr/lib/libTKXSBase.so.7 #0000014 0x00007ffff3cc1fc2 in STEPControl_Writer::Transfer(TopoDS_Shape const&, STEPControl_StepModelType, bool) () from /usr/lib/libTKSTEP.so.7
Public activity
4 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Fri Nov 13 19:59:24 2020 +0300
0031925: Foundation Classes, OSD_Host::InternetAddress() - possible NULL dereference on copying gethostbyname() result
Changes on non-Windows platforms:
- Deprecated gethostbyname() has been replaced by getifaddrs()+inet_ntop() handling IPv4+IPv6 addresses;
- External IPs are now preferred comparing to dummy localhost [network address removed].
[revision removed]
Detailed log of new commits:
Author: Author
Date: Fri Nov 13 19:59:24 2020 +0300
0031925: Foundation Classes, OSD_Host::InternetAddress() - possible NULL dereference on copying gethostbyname() result
Changes on non-Windows platforms:
- Deprecated gethostbyname() has been replaced by getifaddrs()+inet_ntop() handling IPv4+IPv6 addresses;
- External IPs are now preferred comparing to dummy localhost [network address removed].
Patch is ready for review
- OCCT branch: [archived branch]
http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31925-master-KGV/view/COMPARE/
- OCCT branch: [archived branch]
http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31925-master-KGV/view/COMPARE/
Reviewed, please integrate; note that the patch should be checked for compilation on old Linux platforms
Branch [archived branch] has been updated by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Fri Nov 20 12:04:33 2020 +0300
# fallback for old Android
[revision removed]
Detailed log of new commits:
Author: Author
Date: Fri Nov 20 12:04:33 2020 +0300
# fallback for old Android