Bug 120973 - nested assignments in asserts + subscripts out of range
Summary: nested assignments in asserts + subscripts out of range
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-04-15 19:57 UTC by d.binderman
Modified: 2014-03-17 02:44 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-04-19 20:13:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2004-04-15 19:57:07 UTC
Description of problem:

I just tried to compile Core2 Test2 package alsa-lib-1.0.3a-1

The compiler said

1.

pcm.c(754): warning #175: subscript out of range

The source code is

       
snd_interval_set_value(&params->intervals[SND_PCM_HW_PARAM_PERIOD_SIZE],
pcm->period_size);

but

        struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
                                       
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];

I make it that the array has 12 elements, and the source code asks
for element #13.

2.

pcm.c(755): warning #175: subscript out of range
pcm.c(756): warning #175: subscript out of range
pcm.c(757): warning #175: subscript out of range
pcm.c(758): warning #175: subscript out of range
pcm.c(759): warning #175: subscript out of range

Duplicates.

3.

iwffff.c(644): warning #175: subscript out of range

The source code is

    gwave->share_id[4] = snd_LE_to_host_32(*(((unsigned int *)wave) +
8/4));

but 

	unsigned int share_id[4];

4.

iwffff.c(880): warning #175: subscript out of range
iwffff.c(880): warning #175: subscript out of range

Duplicates.

5. 

More deeply, I checked for nested assigments in assert statements. I found

[dcb@localhost BUILD]$ find . -name \*.c -print | xargs grep -n
"assert.*(.* = "
./alsa-lib-1.0.3a/src/pcm/pcm.c:1799:   assert(handler->type =
SND_ASYNC_HANDLER_PCM);
./alsa-lib-1.0.3a/src/async.c:56:       assert(siginfo->si_code =
SI_SIGIO);
./alsa-lib-1.0.3a/src/control/control.c:539:    assert(handler->type =
SND_ASYNC_HANDLER_CTL);

I'm not saying this is certainly wrong code, I'm only saying it is IMHO
deeply suspicious code.


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


How reproducible:


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


Expected results:


Additional info:

Comment 1 Bill Nottingham 2004-04-19 20:13:45 UTC
Please file upstream at:
  https://bugtrack.alsa-project.org/alsa-bug/login_page.php

Thanks!

Comment 2 d.binderman 2004-04-19 21:41:20 UTC
>Please file upstream at:

Sorry, but I am unable to.

If you were to help me out here by submitting it,
on my behalf, then that would be ok with me.




Note You need to log in before you can comment on or make changes to this bug.