[file-roller/gnome-3-20] Fix integer overflow bug when comparing large files/directories



commit 7ef256ec320f8f81ee093c914b62dea20c138ae1
Author: Jan Achterhold <devel janachterhold de>
Date:   Sun Oct 23 17:11:10 2016 +0200

    Fix integer overflow bug when comparing large files/directories

 src/fr-window.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index fd161b7..a3ad349 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -5123,6 +5123,7 @@ size_column_sort_func (GtkTreeModel *model,
        FileData    *fdata2;
        GtkSortType  sort_order;
        int          result;
+       goffset      size_difference;
 
        gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (model), NULL, &sort_order);
 
@@ -5131,9 +5132,10 @@ size_column_sort_func (GtkTreeModel *model,
 
        if (file_data_is_dir (fdata1) == file_data_is_dir (fdata2)) {
                if (file_data_is_dir (fdata1))
-                       result = fdata1->dir_size - fdata2->dir_size;
+                       size_difference = fdata1->dir_size - fdata2->dir_size;
                else
-                       result = fdata1->size - fdata2->size;
+                       size_difference = fdata1->size - fdata2->size;
+               result = (size_difference > 0) - (size_difference < 0);
         }
         else {
                result = file_data_is_dir (fdata1) ? -1 : 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]