Fix valgrind found memcpy issues in codec_ilbc.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 25 Sep 2012 17:22:25 +0000 (17:22 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 25 Sep 2012 17:22:25 +0000 (17:22 +0000)
Valgrind found codec_ilbc using memcpy instead of memmove for overlapping
memory blocks.

(issue ASTERISK-19890)
(closes issue ASTERISK-20231)
Reported by: Walter Doekes
Patches:
      ASTERISK-20231.patch (license #5674) patch uploaded by Walter Doekes
........

Merged revisions 373640 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 373645 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 373650 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373656 65c4cc65-6c06-0410-ace0-fbb531ad65f3

codecs/ilbc/iLBC_decode.c
codecs/ilbc/iLBC_encode.c

index 978d480..e7bda11 100644 (file)
 
                /* update memory */
 
-               memcpy(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
+               memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
                memcpy(mem+CB_MEML-SUBL,
 
 
 
                /* update memory */
 
-               memcpy(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
+               memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
                memcpy(mem+CB_MEML-SUBL,
                    &reverseDecresidual[subframe*SUBL],
                    SUBL*sizeof(float));
index 4636414..4c2e6f7 100644 (file)
 
                /* update memory */
 
-               memcpy(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
+               memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
                memcpy(mem+CB_MEML-SUBL,
 
 
 
                /* update memory */
 
-               memcpy(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
+               memmove(mem, mem+SUBL, (CB_MEML-SUBL)*sizeof(float));
                memcpy(mem+CB_MEML-SUBL,
                    &reverseDecresidual[subframe*SUBL],
                    SUBL*sizeof(float));