From 96d6a74e25976c64657c5a060494e667d4ab3643 Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Sun, 28 Feb 2016 20:32:36 +0100 Subject: fix possible crash in tools/editor/spatial_editor_gizmos.cpp spatial_node and base where uninitialized, which could lead to crash --- tools/editor/spatial_editor_gizmos.cpp | 4 ++-- tools/editor/spatial_editor_gizmos.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index d4bc701dad..3414e80482 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -708,7 +708,8 @@ void EditorSpatialGizmo::_bind_methods() { EditorSpatialGizmo::EditorSpatialGizmo() { valid=false; billboard_handle=false; - + base=NULL; + spatial_node=NULL; } EditorSpatialGizmo::~EditorSpatialGizmo(){ @@ -3219,4 +3220,3 @@ SpatialEditorGizmos::SpatialEditorGizmos() { } - diff --git a/tools/editor/spatial_editor_gizmos.h b/tools/editor/spatial_editor_gizmos.h index 346e360225..0162bcbf79 100644 --- a/tools/editor/spatial_editor_gizmos.h +++ b/tools/editor/spatial_editor_gizmos.h @@ -491,4 +491,3 @@ public: }; #endif // SPATIAL_EDITOR_GIZMOS_H - -- cgit v1.2.3 From 19ea9ae1e5ad51e22c32d4f6593e93c7ef58f491 Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Sun, 28 Feb 2016 20:37:43 +0100 Subject: fix possible crash in tools/editor/editor_import_export.cpp da could be NULL, and dereferencing NULL could lead to crash --- tools/editor/editor_import_export.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index a1fe875287..e02ffd337b 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -281,6 +281,7 @@ static void _edit_filter_list(Set& r_list,const String& p_filter,boo } DirAccess *da = DirAccess::open("res://"); + ERR_FAIL_NULL(da); _edit_files_with_filter(da,filters,r_list,exclude); memdelete(da); } @@ -2217,5 +2218,3 @@ EditorImportExport::~EditorImportExport() { } - - -- cgit v1.2.3 From bf7f9244a95962c9833e68743726fe83a00b732c Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Mon, 29 Feb 2016 23:36:19 +0100 Subject: fix two reading uninitialized pointers fixed in: tools/editor/project_settings.cpp scene/gui/graph_edit.cpp --- tools/editor/project_settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/editor') diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 88833e4963..4a7388fd54 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -966,7 +966,7 @@ void ProjectSettings::_autoload_delete(Object *p_item,int p_column, int p_button undo_redo->commit_action(); } else { - TreeItem *swap; + TreeItem *swap = NULL; if (p_button==1) { swap=ti->get_prev(); -- cgit v1.2.3 From 7b07bcaf449ea6cf52c2ac501e48cddbe4bde035 Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Tue, 1 Mar 2016 00:08:33 +0100 Subject: fix six possible "divide by zero" --- tools/editor/plugins/editor_preview_plugins.cpp | 6 +++++- tools/editor/plugins/script_editor_plugin.cpp | 4 ++-- tools/editor/plugins/spatial_editor_plugin.cpp | 7 +++---- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index f3b5272571..12d50cd4b8 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -725,7 +725,11 @@ Ref EditorSamplePreviewPlugin::generate(const RES& p_from) { } else { half=1; ofs=h/2; - v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + if( (float)(h/2) != 0 ) { + v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + } else { + v = ((j-(h/2))/(float)(1/2)) * 2.0 - 1.0; + } } uint8_t* imgofs = &imgw[(j*w+i)*3]; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 2fb5dd619e..76c64beb61 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1784,7 +1784,8 @@ void ScriptEditor::_update_script_colors() { if (h>hist_size) { continue; } - float v = Math::ease((edit_pass-pass)/float(hist_size),0.4); + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); @@ -2704,4 +2705,3 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { ScriptEditorPlugin::~ScriptEditorPlugin() { } - diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e787c74702..79ff78ca0d 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -2084,7 +2084,9 @@ void SpatialEditorViewport::_menu_option(int p_option) { count++; } - center/=float(count); + if( count != 0 ) { + center/=float(count); + } cursor.pos=center; } break; @@ -4240,6 +4242,3 @@ SpatialEditorPlugin::SpatialEditorPlugin(EditorNode *p_node) { SpatialEditorPlugin::~SpatialEditorPlugin() { } - - - -- cgit v1.2.3