Title: [131198] trunk/Source/WebCore
- Revision
- 131198
- Author
- [email protected]
- Date
- 2012-10-12 10:33:33 -0700 (Fri, 12 Oct 2012)
Log Message
Check parameter's safety first
https://bugs.webkit.org/show_bug.cgi?id=99136
Patch by Jaehun Lim <[email protected]> on 2012-10-12
Reviewed by Chris Rogers.
Pointer parameter was used before NULL checking.
This patch moves safety checking statements to the head of the function.
No new tests. No behavior change.
* platform/audio/AudioChannel.cpp:
(WebCore::AudioChannel::copyFromRange):
(WebCore::AudioChannel::sumFrom):
* platform/audio/EqualPowerPanner.cpp:
(WebCore::EqualPowerPanner::pan):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (131197 => 131198)
--- trunk/Source/WebCore/ChangeLog 2012-10-12 17:13:29 UTC (rev 131197)
+++ trunk/Source/WebCore/ChangeLog 2012-10-12 17:33:33 UTC (rev 131198)
@@ -1,3 +1,21 @@
+2012-10-12 Jaehun Lim <[email protected]>
+
+ Check parameter's safety first
+ https://bugs.webkit.org/show_bug.cgi?id=99136
+
+ Reviewed by Chris Rogers.
+
+ Pointer parameter was used before NULL checking.
+ This patch moves safety checking statements to the head of the function.
+
+ No new tests. No behavior change.
+
+ * platform/audio/AudioChannel.cpp:
+ (WebCore::AudioChannel::copyFromRange):
+ (WebCore::AudioChannel::sumFrom):
+ * platform/audio/EqualPowerPanner.cpp:
+ (WebCore::EqualPowerPanner::pan):
+
2012-10-12 Andreas Kling <[email protected]>
RenderBR should share its constant newline string between instances.
Modified: trunk/Source/WebCore/platform/audio/AudioChannel.cpp (131197 => 131198)
--- trunk/Source/WebCore/platform/audio/AudioChannel.cpp 2012-10-12 17:13:29 UTC (rev 131197)
+++ trunk/Source/WebCore/platform/audio/AudioChannel.cpp 2012-10-12 17:33:33 UTC (rev 131198)
@@ -65,15 +65,15 @@
void AudioChannel::copyFromRange(const AudioChannel* sourceChannel, unsigned startFrame, unsigned endFrame)
{
- if (sourceChannel->isSilent() && isSilent())
- return;
-
// Check that range is safe for reading from sourceChannel.
bool isRangeSafe = sourceChannel && startFrame < endFrame && endFrame <= sourceChannel->length();
ASSERT(isRangeSafe);
if (!isRangeSafe)
return;
+ if (sourceChannel->isSilent() && isSilent())
+ return;
+
// Check that this channel has enough space.
size_t rangeLength = endFrame - startFrame;
bool isRangeLengthSafe = rangeLength <= length();
@@ -95,14 +95,14 @@
void AudioChannel::sumFrom(const AudioChannel* sourceChannel)
{
- if (sourceChannel->isSilent())
- return;
-
bool isSafe = sourceChannel && sourceChannel->length() >= length();
ASSERT(isSafe);
if (!isSafe)
return;
+ if (sourceChannel->isSilent())
+ return;
+
if (isSilent())
copyFrom(sourceChannel);
else
Modified: trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp (131197 => 131198)
--- trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2012-10-12 17:13:29 UTC (rev 131197)
+++ trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2012-10-12 17:33:33 UTC (rev 131198)
@@ -51,12 +51,13 @@
void EqualPowerPanner::pan(double azimuth, double /*elevation*/, const AudioBus* inputBus, AudioBus* outputBus, size_t framesToProcess)
{
- unsigned numberOfInputChannels = inputBus->numberOfChannels();
- bool isInputSafe = inputBus && (numberOfInputChannels == 1 || numberOfInputChannels == 2) && framesToProcess <= inputBus->length();
+ bool isInputSafe = inputBus && (inputBus->numberOfChannels() == 1 || inputBus->numberOfChannels() == 2) && framesToProcess <= inputBus->length();
ASSERT(isInputSafe);
if (!isInputSafe)
return;
+ unsigned numberOfInputChannels = inputBus->numberOfChannels();
+
bool isOutputSafe = outputBus && outputBus->numberOfChannels() == 2 && framesToProcess <= outputBus->length();
ASSERT(isOutputSafe);
if (!isOutputSafe)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes