Skip to content
Snippets Groups Projects
Commit a969ebae authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #27201: libiax: avoid out of bounds read in a more obvious way

parent 3e1545b4
Branches
Tags
No related merge requests found
...@@ -239,7 +239,7 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -239,7 +239,7 @@ static void history_calc_maxbuf(jitterbuf *jb)
if (toins > jb->hist_maxbuf[j]) { if (toins > jb->hist_maxbuf[j]) {
/* move over if there's space */ /* move over if there's space */
const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0]); const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0]);
if (slide > 0) if (j < (JB_HISTORY_MAXBUF_SZ - 1))
memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, slide); memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, slide);
/* insert */ /* insert */
jb->hist_maxbuf[j] = toins; jb->hist_maxbuf[j] = toins;
...@@ -258,7 +258,7 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -258,7 +258,7 @@ static void history_calc_maxbuf(jitterbuf *jb)
if (toins < jb->hist_minbuf[j]) { if (toins < jb->hist_minbuf[j]) {
/* move over if there's space */ /* move over if there's space */
const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]); const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]);
if (slide > 0) if (j < (JB_HISTORY_MAXBUF_SZ - 1))
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, slide); memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, slide);
/* insert */ /* insert */
jb->hist_minbuf[j] = toins; jb->hist_minbuf[j] = toins;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment