Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.

Bug 113763

Summary: six bugs found at compile time
Product: [Fedora] Fedora Reporter: d.binderman
Component: evolutionAssignee: Dave Malcolm <dmalcolm>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: bart.martens
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-05-17 21:45:32 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
memleak and minor bugs none

Description d.binderman 2004-01-17 06:47:10 EST
Description of problem:

I just tried to compile package evolution-1.4.5-7, from Redhat
Fedora Core 1.

The compiler said

1.

sspm.c(1172): remark #592: variable "cc" is used before its value is set

The source code is

    int cc;
    char buf[4] = {0,0,0,0};
    int p = 0;
    int valid_data = 0;
    size_t size_out=0;

    while (*src && p<(int)*size && (cc!=  -1)) {

I think the compiler is correct. Suggest initialise cc before first use.


2.

e-timezone-dialog.c(139): remark #592: variable "dialog" is used
before its value is set

The source code is

        GtkWidget *dialog;

        g_return_if_fail (object != NULL);
        g_return_if_fail (E_IS_TIMEZONE_DIALOG (object));

        etd = E_TIMEZONE_DIALOG (object);
        priv = etd->priv;

        /* Destroy the actual dialog. */
        if (dialog != NULL) {


Suggest initialise variable "dialog" before first use.


3.

../mail/mail-callbacks.h(132): error: invalid specifier on a parameter

The source code is

  void forward_messages    (CamelFolder *folder, GPtrArray *uids,
gboolean inline);

Suggest select a better name for the third parameter than "inline",
which is a reserved word for most C compilers.


4.

netscape-importer.c(319): warning #175: subscript out of range

The source code is

                } else if (!strcmp (type,
ns_filter_condition_types[AGE_IN_DAYS])) {

but

typedef enum {
        FROM, SUBJECT, TO, CC, TO_OR_CC, BODY, DATE, PRIORITY,
        STATUS, AGE_IN_DAYS, X_MSG_HEADER
} NsFilterConditionType;

so AGE_IN_DAYS has the value 9, but 

static char *ns_filter_condition_types[] =
{
        "from", "subject", "to", "CC", "to or CC", "body", "date",
        "priority", "age in days"
};

there are only 9 array elements. Arrays in C are exclusive, not inclusive


5.

netscape-importer.c(321): warning #175: subscript out of range

Duplicate. X_MSG_HEADER has the value 10.


6.

mail-config.c(1218): remark #592: variable "source" is used before its
value is
set

The source code is

        GNOME_Evolution_MailConfig_Service source, transport;
        GNOME_Evolution_MailConfig_Identity id;
        EAccount *new;

        if (mail_config_get_account_by_name (account->name)) {
                /* FIXME: we need an exception. */
                return;
        }

        new = e_account_new ();
        new->name = g_strdup (account->name);
        new->enabled = source.enabled;

Here again, source is read from before it is initialised.



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Bart Martens 2004-02-01 09:04:13 EST
Created attachment 97403 [details]
memleak and minor bugs

1. Implicit init was good, added an explicit init.
2. Memory leak fixed. The dialog was never freed.
3. Removed obsolete function declaration from include file.
4. Added missing value in array.
5. Added missing value in array.
6. Use variable after assignment, not before.
Comment 2 Jef Spaleta 2004-02-11 22:15:45 EST
Is there an upstream bug at ximian about these leaks
that could be referenced here?
Comment 3 Dave Malcolm 2004-05-05 16:41:30 EDT
Looking at CVS HEAD, for Evolution 1.5.*:
1. is now in evolution-data-server and has been fixed.
2. appears to have been fixed in CVS
3. file doesn't appear to exist anymore in CVS HEAD
4. appears to have been rewritten, though the enum/array mismatch is
still present in CVS...
5. ...which causes this, which looks like a genuine bug.  I've filed
this in Ximian's Bugzilla as bug #58090
6. This code appears not to exist anymore