Re: MIVA Empresa Bugs?
Found a trivially reproducible segfault in 5.13 in the config file parser library (distributed as 3x.so); tested on CentOS 4 with the i386 binary. Omitting a field in one of the config file entries will get you a crash; expected behavior would be a parse error and orderly exit.
Example config line to reproduce:
<DATABASE-LIB LIBRARY ="/home3/johnsons/upgrade/public_html/cgi-bin/lib/databases/mivasql.so">
(note that the above omits the METHOD field)
Resulting stack trace (using Valgrind) below, which suggests a simple NULL pointer dereference problem. Probably a quick fix.
==1234== Memcheck, a memory error detector.
==1234== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==1234== Using LibVEX rev 1575, a library for dynamic binary translation.
==1234== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==1234== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==1234== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==1234== For more details, rerun with: -v
==1234==
==1234== Invalid read of size 1
==1234== at 0x4005E7C: strlen (mac_replace_strmem.c:243)
==1234== by 0x80983CB: CommerceLibrary::CommerceLibrary(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8098803: CommerceLibraryManager::RegisterDSO(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x80A6AA1: ExternalConfig::Register_Library_Commerce(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8114E82: mvConfig_Register_Library_Commerce (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x411B7A0: config3x_tag_end (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411CEBE: config_parse (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411A852: config3x_loadconfiguration (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x4119D3A: config3x_api_init (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x80A65AC: ExternalConfig::Load(char const *, int, void *, int) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8078EE7: CGIApplication::LoadConfiguration(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x807870B: CGIApplication::Go(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==1234==
==1234== Process terminating with default action of signal 11 (SIGSEGV)
==1234== Access not within mapped region at address 0x0
==1234== at 0x4005E7C: strlen (mac_replace_strmem.c:243)
==1234== by 0x80983CB: CommerceLibrary::CommerceLibrary(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8098803: CommerceLibraryManager::RegisterDSO(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x80A6AA1: ExternalConfig::Register_Library_Commerce(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8114E82: mvConfig_Register_Library_Commerce (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x411B7A0: config3x_tag_end (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411CEBE: config_parse (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411A852: config3x_loadconfiguration (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x4119D3A: config3x_api_init (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x80A65AC: ExternalConfig::Load(char const *, int, void *, int) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8078EE7: CGIApplication::LoadConfiguration(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x807870B: CGIApplication::Go(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234==
==1234== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 33 from 2)
==1234== malloc/free: in use at exit: 284,989 bytes in 164 blocks.
==1234== malloc/free: 194 allocs, 30 frees, 285,916 bytes allocated.
==1234== For counts of detected errors, rerun with: -v
==1234== searching for pointers to 164 not-freed blocks.
==1234== checked 808,896 bytes.
==1234==
==1234== LEAK SUMMARY:
==1234== definitely lost: 80 bytes in 16 blocks.
==1234== possibly lost: 0 bytes in 0 blocks.
==1234== still reachable: 284,909 bytes in 148 blocks.
==1234== suppressed: 0 bytes in 0 blocks.
==1234== Use --leak-check=full to see details of leaked memory.
Segmentation fault
Found a trivially reproducible segfault in 5.13 in the config file parser library (distributed as 3x.so); tested on CentOS 4 with the i386 binary. Omitting a field in one of the config file entries will get you a crash; expected behavior would be a parse error and orderly exit.
Example config line to reproduce:
<DATABASE-LIB LIBRARY ="/home3/johnsons/upgrade/public_html/cgi-bin/lib/databases/mivasql.so">
(note that the above omits the METHOD field)
Resulting stack trace (using Valgrind) below, which suggests a simple NULL pointer dereference problem. Probably a quick fix.
==1234== Memcheck, a memory error detector.
==1234== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==1234== Using LibVEX rev 1575, a library for dynamic binary translation.
==1234== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==1234== Using valgrind-3.1.1, a dynamic binary instrumentation framework.
==1234== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==1234== For more details, rerun with: -v
==1234==
==1234== Invalid read of size 1
==1234== at 0x4005E7C: strlen (mac_replace_strmem.c:243)
==1234== by 0x80983CB: CommerceLibrary::CommerceLibrary(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8098803: CommerceLibraryManager::RegisterDSO(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x80A6AA1: ExternalConfig::Register_Library_Commerce(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8114E82: mvConfig_Register_Library_Commerce (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x411B7A0: config3x_tag_end (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411CEBE: config_parse (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411A852: config3x_loadconfiguration (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x4119D3A: config3x_api_init (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x80A65AC: ExternalConfig::Load(char const *, int, void *, int) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8078EE7: CGIApplication::LoadConfiguration(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x807870B: CGIApplication::Go(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==1234==
==1234== Process terminating with default action of signal 11 (SIGSEGV)
==1234== Access not within mapped region at address 0x0
==1234== at 0x4005E7C: strlen (mac_replace_strmem.c:243)
==1234== by 0x80983CB: CommerceLibrary::CommerceLibrary(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8098803: CommerceLibraryManager::RegisterDSO(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x80A6AA1: ExternalConfig::Register_Library_Commerce(char const *, char const *) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8114E82: mvConfig_Register_Library_Commerce (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x411B7A0: config3x_tag_end (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411CEBE: config_parse (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x411A852: config3x_loadconfiguration (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x4119D3A: config3x_api_init (in /someuser/webroot/cgi-bin/libmivaconfig.so)
==1234== by 0x80A65AC: ExternalConfig::Load(char const *, int, void *, int) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x8078EE7: CGIApplication::LoadConfiguration(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234== by 0x807870B: CGIApplication::Go(void) (in /someuser/webroot/cgi-bin/mivavm)
==1234==
==1234== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 33 from 2)
==1234== malloc/free: in use at exit: 284,989 bytes in 164 blocks.
==1234== malloc/free: 194 allocs, 30 frees, 285,916 bytes allocated.
==1234== For counts of detected errors, rerun with: -v
==1234== searching for pointers to 164 not-freed blocks.
==1234== checked 808,896 bytes.
==1234==
==1234== LEAK SUMMARY:
==1234== definitely lost: 80 bytes in 16 blocks.
==1234== possibly lost: 0 bytes in 0 blocks.
==1234== still reachable: 284,909 bytes in 148 blocks.
==1234== suppressed: 0 bytes in 0 blocks.
==1234== Use --leak-check=full to see details of leaked memory.
Segmentation fault
Comment