Bug in pjmedia/wav_player.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello folks!

The bug discovered is in wav_player.c: when you invoke pjmedia_wav_player_port_get_pos() right after player has created (the position is 0)
or when no loop is specified and player already reached EOF and stopped (the position is again 0) - division by zero occurs.
Here is the patch proposed to address this small problem.



--- pjmedia/src/pjmedia/1/wav_player.c    2019-08-23 03:23:24.192815138 +0800
+++ pjmedia/src/pjmedia/wav_player.c    2019-08-23 03:32:56.404331754 +0800
@@ -538,7 +538,10 @@
     fport = (struct file_reader_port*) port;
 
     payload_pos = (pj_size_t)(fport->fpos - fport->start_data);
-    if (payload_pos >= fport->bufsize)
+
+    if (payload_pos == 0)
+    return 0;
+    else if (payload_pos >= fport->bufsize)
     return payload_pos - fport->bufsize + (fport->readpos - fport->buf);
     else
     return (fport->readpos - fport->buf) % payload_pos;


_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux