[haiku-bugs] [Haiku] #9203: Integer overflow in mixer add-on crashes media_addon_server

  • From: "jua" <trac@xxxxxxxxxxxx>
  • Date: Thu, 22 Nov 2012 23:48:21 -0000

#9203: Integer overflow in mixer add-on crashes media_addon_server
-------------------------------------------------+-------------------------
 Reporter:  jua                                  |        Owner:  axeld
     Type:  bug                                  |       Status:  new
 Priority:  normal                               |    Milestone:  R1
Component:  Kits/Media Kit                       |      Version:
 Keywords:  mixer.media_addon                    |  R1/alpha4.1
  media_addon_server                             |   Blocked By:
 Blocking:                                       |  Has a Patch:  0
 Platform:  All                                  |
-------------------------------------------------+-------------------------
 When using an audio device with high sample rate and a BSoundPlayer with a
 large buffer, an integer overflow in MixerInput::BufferReceived() in the
 mixer.media_addon crashes the media_addon_server.

 The overflow happens due to wrong casting, I'm attaching a patch which
 fixes it.

 If you look at the line changed by the patch: when fMixBufferFrameRate is
 192000 (hda chooses 192kHz as default sample rate for my onboard sound)
 and in_frames is 16384 (i.e. quite large buffer), the result of the
 multiplication is 3145728000 which is too large for int32 -- and the cast
 to double happens only after the multiply. The patch changes it so the
 cast happens before.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/9203>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: