|
Bugzilla – Full Text Bug Listing |
| Summary: | micq-0.5.0.4-3:array subscript out of range | ||
|---|---|---|---|
| Product: | [openSUSE] SUSE LINUX 10.0 | Reporter: | David Binderman <dcb314> |
| Component: | Basesystem | Assignee: | Stefan Dirsch <sndirsch> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Minor | ||
| Priority: | P2 - High | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | SuSE Linux 10.1 | ||
| Whiteboard: | |||
| Found By: | Other | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Attachments: | Fixes for macros | ||
Good catch! Good explanation! I'll fix this. Thanks a lot! Created attachment 68968 [details]
Fixes for macros
fixed for 10.1 Beta > 4. |
I just tried to compile package micq-0.5.0.4-3 with the Intel C compiler. It said contact.c(1240): warning #175: subscript out of range The source code is else if (HAS_CAP (cont->caps, CAP_TRILL_CRYPT | CAP_TRILL_2)) but #define HAS_CAP(caps,cap) (((caps)[cap / 32]) & (1UL << (cap % 32))) and CAP_TRILL_CRYPT has the value 18 and the CAP_TRILL_2 has a value of 19. So making the macro subsitution else if (((cont->caps)[ CAP_TRILL_CRYPT | CAP_TRILL_2 / 32]) & (1UL << (CAP_TRILL_CRYPT | CAP_TRILL_2 % 32))) I just checked the C precedence table. Both / and % are higher than | so the macro expansion is the same as else if (((cont->caps)[ CAP_TRILL_CRYPT | (CAP_TRILL_2 / 32)]) & (1UL << (CAP_TRILL_CRYPT | (CAP_TRILL_2 % 32)))) hence the compiler complaining. Suggest modify the macro definition #define HAS_CAP(caps,cap) (((caps)[(cap) / 32]) & (1UL << ((cap) % 32))) Note the extra () around the uses of cap to ensure correct evaluation.