frameworks/av
Révision | 5ea21496069255bfbe0ff71db37624e2cafac406 (tree) |
---|---|
l'heure | 2020-04-23 21:50:38 |
Auteur | Michael Goffioul <michael.goffioul@gmai...> |
Commiter | Chih-Wei Huang |
Fix unsafe use of memcpy in audiopreprocessing
Memcpy cannot be used with overlapping memory areas. One should use
memmove instead.
@@ -1239,7 +1239,7 @@ int PreProcessingFx_Process(effect_handle_t self, | ||
1239 | 1239 | memcpy(outBuffer->s16, |
1240 | 1240 | session->outBuf, |
1241 | 1241 | fr * session->outChannelCount * sizeof(int16_t)); |
1242 | - memcpy(session->outBuf, | |
1242 | + memmove(session->outBuf, | |
1243 | 1243 | session->outBuf + fr * session->outChannelCount, |
1244 | 1244 | (session->framesOut - fr) * session->outChannelCount * sizeof(int16_t)); |
1245 | 1245 | session->framesOut -= fr; |
@@ -1302,7 +1302,7 @@ int PreProcessingFx_Process(effect_handle_t self, | ||
1302 | 1302 | session->procFrame->data_, |
1303 | 1303 | &frOut); |
1304 | 1304 | } |
1305 | - memcpy(session->inBuf, | |
1305 | + memmove(session->inBuf, | |
1306 | 1306 | session->inBuf + frIn * session->inChannelCount, |
1307 | 1307 | (session->framesIn - frIn) * session->inChannelCount * sizeof(int16_t)); |
1308 | 1308 | session->framesIn -= frIn; |
@@ -1380,7 +1380,7 @@ int PreProcessingFx_Process(effect_handle_t self, | ||
1380 | 1380 | memcpy(outBuffer->s16 + framesWr * session->outChannelCount, |
1381 | 1381 | session->outBuf, |
1382 | 1382 | fr * session->outChannelCount * sizeof(int16_t)); |
1383 | - memcpy(session->outBuf, | |
1383 | + memmove(session->outBuf, | |
1384 | 1384 | session->outBuf + fr * session->outChannelCount, |
1385 | 1385 | (session->framesOut - fr) * session->outChannelCount * sizeof(int16_t)); |
1386 | 1386 | session->framesOut -= fr; |
@@ -1836,7 +1836,7 @@ int PreProcessingFx_ProcessReverse(effect_handle_t self, | ||
1836 | 1836 | session->revFrame->data_, |
1837 | 1837 | &frOut); |
1838 | 1838 | } |
1839 | - memcpy(session->revBuf, | |
1839 | + memmove(session->revBuf, | |
1840 | 1840 | session->revBuf + frIn * session->inChannelCount, |
1841 | 1841 | (session->framesRev - frIn) * session->inChannelCount * sizeof(int16_t)); |
1842 | 1842 | session->framesRev -= frIn; |