! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[process-tree-view.c:314]: (style) Array index 'i' is used before limits check.
Status:
RESOLVED: FIXED
Product:
Xfce4-taskmanager
Component:
General

Comments

Description David Binderman 2014-02-02 13:10:34 CET
I just ran the static analysis tool cppcheck
over the source code of xfce4-taskmanager-1.0.1

It said many things, including

[process-tree-view.c:314]: (style) Array index 'i' is used before limits check.

Source code is

        for (i = 0; columns_positions_split[i] != NULL && i < N_COLUMNS; i++)

Maybe

        for (i = 0; i < N_COLUMNS && columns_positions_split[i] != NULL; i++)

would be better code. I also checked the latest code online
and the problem exists there also.
Comment 1 Landry Breuil editbugs 2014-11-29 12:09:20 CET
interestingly cppcheck doesnt complain here, what arguments did you use ?
What were the other 'many things' ?
Comment 2 David Binderman 2014-11-30 20:20:29 CET
(In reply to Landry Breuil from comment #1)
> interestingly cppcheck doesnt complain here, what arguments did you use ?

--enable=all 

> What were the other 'many things' ?

I've no idea. I filed this bug nearly ten months ago, and the
relevant data has seen been deleted. 

Any bug report not answered in six months is deemed to be dead
and any relevant data is deleted.

I suggest you run cppcheck with flag --enable-all over 
your current source code and investigate what it says.
Comment 3 Landry Breuil editbugs 2014-11-30 21:42:25 CET
Funny, even with --enable=all cppcheck 1.67 doesnt yield this message here, i suppose it depends on the underlying compiler version or the environment.
Comment 4 Landry Breuil editbugs 2014-11-30 21:48:51 CET
Applied anyway in 095098f8, thx.

Bug #10664

Reported by:
David Binderman
Reported on: 2014-02-02
Last modified on: 2014-11-30

People

Assignee:
Mike Massonnet
CC List:
1 user

Version

Version:
unspecified

Attachments

Additional information