The default bug view has changed. See this FAQ.

nsAudioAvailableEventManager.cpp:195:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

RESOLVED FIXED in mozilla14

Status

()

Core
Audio/Video
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks: 1 bug)

Trunk
mozilla14
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Filing bug on this build warning...
{
../../../mozilla/content/media/nsAudioAvailableEventManager.cpp: In member function ‘void nsAudioAvailableEventManager::QueueWrittenAudioData(AudioDataValue*, PRUint32, PRUint64)’:
../../../mozilla/content/media/nsAudioAvailableEventManager.cpp:195:35: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
}

...for this chunk of code...

> 149   PRUint32 audioDataLength = aAudioDataLength;
[...]
> 153   while (signalBufferTail <= audioDataLength) {
[...]
> 167     audioData += signalBufferTail;
> 168     audioDataLength -= signalBufferTail;
[...]
> 195     NS_ASSERTION(audioDataLength >= 0, "Past new signal data length.");
[...]
> 209   }

...which was added in bug 490705.

Note that audioDataLength is unsigned, so it's >= 0 by definition.

If we actually want to assert that it's not going to wrap around, we should assert _just before_ line 168 that we're not about to subtract a value larger than audioDataLength.
(Assignee)

Comment 1

5 years ago
Created attachment 614866 [details] [diff] [review]
fix
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #614866 - Flags: review?(david.humphrey)
(Assignee)

Updated

5 years ago
Blocks: 187528
(Assignee)

Comment 2

5 years ago
(this is a build warning from g++ 4.6.3, FWIW)
Comment on attachment 614866 [details] [diff] [review]
fix

Review of attachment 614866 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good, thanks for catching it.  Since I'm not an owner/peer, I'm going to ask cpearce to look at this.
Attachment #614866 - Flags: review?(david.humphrey)
Attachment #614866 - Flags: review?(cpearce)
Attachment #614866 - Flags: review+
Comment on attachment 614866 [details] [diff] [review]
fix

Review of attachment 614866 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good.
Attachment #614866 - Flags: review?(cpearce) → review+
(Assignee)

Comment 5

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/cfcd178b2f5f
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/cfcd178b2f5f
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.