Anonymous avatar Anonymous committed 14645aa

fixed potential buffer overrun in volume code

Comments (0)

Files changed (1)

indra/media_plugins/winmmshim/winmm_shim.cpp

 
 						// copy volume level 4 times into 64 bit MMX register
 						__m64 volume_64 = _mm_set_pi16(volume_16, volume_16, volume_16, volume_16);
-						__m64 *sample_64;
+						__m64* sample_64;
+						__m64* last_sample_64 =  (__m64*)(pwh->lpData + pwh->dwBufferLength - sizeof(__m64));
 						// for everything that can be addressed in 64 bit multiples...
 						for (sample_64 = (__m64*)pwh->lpData;
-							sample_64 < (__m64*)(pwh->lpData + pwh->dwBufferLength);
+							sample_64 <= last_sample_64;
 							++sample_64)
 						{
 							//...multiply the samples by the volume...
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.