diff --git a/src/Mod/Draft/App/dxf.cpp b/src/Mod/Draft/App/dxf.cpp index 3d41ee72e0..4f5bff5e4d 100644 --- a/src/Mod/Draft/App/dxf.cpp +++ b/src/Mod/Draft/App/dxf.cpp @@ -164,12 +164,15 @@ void CDxfWrite::WriteEllipse(const double* c, double major_radius, double minor_ CDxfRead::CDxfRead(const char* filepath) { // start the file + memset( m_str, '\0', sizeof(m_str) ); memset( m_unused_line, '\0', sizeof(m_unused_line) ); m_fail = false; m_aci = 0; m_eUnits = eMillimeters; m_measurement_inch = false; strcpy(m_layer_name, "0"); // Default layer name + memset( m_section_name, '\0', sizeof(m_section_name) ); + memset( m_block_name, '\0', sizeof(m_block_name) ); m_ignore_errors = true; m_ifs = new ifstream(filepath); @@ -406,7 +409,7 @@ bool CDxfRead::ReadArc() double start_angle = 0.0;// in degrees double end_angle = 0.0; double radius = 0.0; - double c[3]; // centre + double c[3] = {0,0,0}; // centre double z_extrusion_dir = 1.0; bool hidden = false; @@ -946,7 +949,7 @@ static bool poly_prev_found = false; static double poly_prev_x; static double poly_prev_y; static double poly_prev_z; -static double poly_prev_bulge_found; +static bool poly_prev_bulge_found = false; static double poly_prev_bulge; static bool poly_first_found = false; static double poly_first_x; @@ -1318,13 +1321,10 @@ void CDxfRead::OnReadEllipse(const double* c, const double* m, double ratio, dou bool CDxfRead::ReadInsert() { - double c[3]; // coordinate - double s[3]; // scale + double c[3] = {0,0,0}; // coordinate + double s[3] = {1,1,1}; // scale double rot = 0.0; // rotation - char name[1024]; - s[0] = 1.0; - s[1] = 1.0; - s[2] = 1.0; + char name[1024] = {0}; while(!((*m_ifs).eof())) { @@ -1413,9 +1413,9 @@ bool CDxfRead::ReadInsert() bool CDxfRead::ReadDimension() { - double s[3]; // startpoint - double e[3]; // endpoint - double p[3]; // dimpoint + double s[3] = {0,0,0}; // startpoint + double e[3] = {0,0,0}; // endpoint + double p[3] = {0,0,0}; // dimpoint double rot = -1.0; // rotation while(!((*m_ifs).eof())) diff --git a/src/Mod/Import/App/dxf.cpp b/src/Mod/Import/App/dxf.cpp index 2468e6ec29..2eced7230c 100644 --- a/src/Mod/Import/App/dxf.cpp +++ b/src/Mod/Import/App/dxf.cpp @@ -1663,12 +1663,15 @@ void CDxfWrite::writeObjectsSection(void) CDxfRead::CDxfRead(const char* filepath) { // start the file + memset( m_str, '\0', sizeof(m_str) ); memset( m_unused_line, '\0', sizeof(m_unused_line) ); m_fail = false; m_aci = 0; m_eUnits = eMillimeters; m_measurement_inch = false; strcpy(m_layer_name, "0"); // Default layer name + memset( m_section_name, '\0', sizeof(m_section_name) ); + memset( m_block_name, '\0', sizeof(m_block_name) ); m_ignore_errors = true; m_ifs = new ifstream(filepath); @@ -2445,7 +2448,7 @@ static bool poly_prev_found = false; static double poly_prev_x; static double poly_prev_y; static double poly_prev_z; -static double poly_prev_bulge_found; +static bool poly_prev_bulge_found = false; static double poly_prev_bulge; static bool poly_first_found = false; static double poly_first_x; @@ -2818,12 +2821,9 @@ void CDxfRead::OnReadEllipse(const double* c, const double* m, double ratio, dou bool CDxfRead::ReadInsert() { double c[3] = {0,0,0}; // coordinate - double s[3] = {0,0,0}; // scale + double s[3] = {1,1,1}; // scale double rot = 0.0; // rotation - char name[1024]; - s[0] = 1.0; - s[1] = 1.0; - s[2] = 1.0; + char name[1024] = {0}; while(!((*m_ifs).eof())) { diff --git a/src/Mod/Path/libarea/dxf.cpp b/src/Mod/Path/libarea/dxf.cpp index 4deb9ff71b..38bd8276fc 100644 --- a/src/Mod/Path/libarea/dxf.cpp +++ b/src/Mod/Path/libarea/dxf.cpp @@ -166,10 +166,13 @@ CDxfRead::CDxfRead(const char* filepath) { m_aci = 0; // start the file + memset( m_str, '\0', sizeof(m_str) ); memset( m_unused_line, '\0', sizeof(m_unused_line) ); m_fail = false; m_eUnits = eMillimeters; strcpy(m_layer_name, "0"); // Default layer name + memset( m_section_name, '\0', sizeof(m_section_name) ); + memset( m_block_name, '\0', sizeof(m_block_name) ); m_ignore_errors = true; m_ifs = new ifstream(filepath); @@ -908,7 +911,7 @@ static bool poly_prev_found = false; static double poly_prev_x; static double poly_prev_y; static double poly_prev_z; -static double poly_prev_bulge_found; +static bool poly_prev_bulge_found = false; static double poly_prev_bulge; static bool poly_first_found = false; static double poly_first_x; @@ -1155,7 +1158,7 @@ bool CDxfRead::ReadPolyLine() bool closed = false; int flags; bool first_vertex_section_found = false; - double first_vertex[3]; + double first_vertex[3] = {0}; bool bulge_found; double bulge; @@ -1256,13 +1259,10 @@ void CDxfRead::OnReadEllipse(const double* c, const double* m, double ratio, dou bool CDxfRead::ReadInsert() { - double c[3]; // coordinate - double s[3]; // scale + double c[3] = {0,0,0}; // coordinate + double s[3] = {1,1,1}; // scale double rot = 0.0; // rotation - char name[1024]; - s[0] = 1.0; - s[1] = 1.0; - s[2] = 1.0; + char name[1024] = {0}; while(!((*m_ifs).eof())) {