Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Side by Side Diff: Source/WebCore/webaudio/AudioBufferSourceNode.cpp

Issue 7756026: Merge 94265 - Do more rigorous bounds checking in AudioBufferSourceNode::renderFromBuffer() (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 float* destinationL = bus->channel(0)->data(); 176 float* destinationL = bus->channel(0)->data();
177 ASSERT(destinationL); 177 ASSERT(destinationL);
178 if (!destinationL) 178 if (!destinationL)
179 return; 179 return;
180 float* destinationR = (numberOfChannels < 2) ? 0 : bus->channel(1)->data(); 180 float* destinationR = (numberOfChannels < 2) ? 0 : bus->channel(1)->data();
181 181
182 bool isStereo = destinationR; 182 bool isStereo = destinationR;
183 183
184 // Sanity check destinationFrameOffset, numberOfFrames. 184 // Sanity check destinationFrameOffset, numberOfFrames.
185 size_t destinationLength = bus->length(); 185 size_t destinationLength = bus->length();
186
187 bool isLengthGood = destinationLength <= 4096 && numberOfFrames <= 4096;
188 ASSERT(isLengthGood);
189 if (!isLengthGood)
190 return;
191
186 bool isOffsetGood = destinationFrameOffset <= destinationLength && destinati onFrameOffset + numberOfFrames <= destinationLength; 192 bool isOffsetGood = destinationFrameOffset <= destinationLength && destinati onFrameOffset + numberOfFrames <= destinationLength;
187 ASSERT(isOffsetGood); 193 ASSERT(isOffsetGood);
188 if (!isOffsetGood) 194 if (!isOffsetGood)
189 return; 195 return;
190 196
191 // Potentially zero out initial frames leading up to the offset. 197 // Potentially zero out initial frames leading up to the offset.
192 if (destinationFrameOffset) { 198 if (destinationFrameOffset) {
193 memset(destinationL, 0, sizeof(float) * destinationFrameOffset); 199 memset(destinationL, 0, sizeof(float) * destinationFrameOffset);
194 if (destinationR) 200 if (destinationR)
195 memset(destinationR, 0, sizeof(float) * destinationFrameOffset); 201 memset(destinationR, 0, sizeof(float) * destinationFrameOffset);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 ASSERT(isTotalRateValid); 430 ASSERT(isTotalRateValid);
425 if (!isTotalRateValid) 431 if (!isTotalRateValid)
426 totalRate = 1.0; 432 totalRate = 1.0;
427 433
428 return totalRate; 434 return totalRate;
429 } 435 }
430 436
431 } // namespace WebCore 437 } // namespace WebCore
432 438
433 #endif // ENABLE(WEB_AUDIO) 439 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698