Bug 110816

Summary: bad source code
Product: [Fedora] Fedora Reporter: d.binderman
Component: gphoto2Assignee: Tim Waugh <twaugh>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: d.binderman
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-11-27 17:28:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-11-24 16:51:22 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)

Description of problem:

I just tried to compile package gphoto2-2_1_2-1 from Fedora.

The compiler said

casio-qv-commands.c(210): warning #175: subscript out of range

The source code is

int
QVsetspeed (Camera *camera, QVSpeed speed)
{
        unsigned char cmd[3];

        cmd[0] = 'C';
        cmd[1] = 'B';
        cmd[3] = (unsigned char) speed;
        CR (QVsend (camera, cmd, 3, NULL, 0));

        return (GP_OK);
}

This code is clearly wrong, by inspection. Suggest change line to

        cmd[ 2] = (unsigned char) speed;


Version-Release number of selected component (if applicable):
gphoto2-2_1_2-1 

How reproducible:
Always

Steps to Reproduce:
1. by inspection
2.
3.
    

Additional info:

Comment 1 Tim Waugh 2003-11-27 09:53:09 UTC
It is far from clear that this is wrong.

(Please report these kind of bugs upstream where possible; thanks.)

Comment 2 d.binderman 2003-11-27 10:01:20 UTC
>It is far from clear that this is wrong.

Let me be more clear.

unsigned char cmd[3];
cmd[3] = (unsigned char) speed;

Array bounds in C are exclusive. cmd[ 3] is not available.

>(Please report these kind of bugs upstream where possible; thanks.)

I've tried that - it didn't work. 

Would it be possible for you to report this bug for me, please ?







Comment 3 Tim Waugh 2003-11-27 17:28:14 UTC
Oh I see what you mean.  Your correction might well be wrong though,
and it isn't clear whether the array should be larger or the values
squashed together.

I've reported it upstream.

Comment 4 David Binderman 2004-11-05 19:38:24 UTC
I can confirm that this bug still exists in Fedora Core 3
Test 3.

It hasn't been fixed in nearly a year.