Bug 2736 - Divide by zero in Squeezebox.pm
: Divide by zero in Squeezebox.pm
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Audio
: 6.2.2
: PC Windows (legacy)
: P2 major (vote)
: ---
Assigned To: KDF
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-20 06:54 UTC by Michael Wagner
Modified: 2008-09-15 14:37 UTC (History)
0 users

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wagner 2005-12-20 06:54:47 UTC
In the latest nightly for 6.2.2.
Slimserver crashes and windows event log says: Illegal division by zero in .../Slim/Player/Squeezebox.pm line 763.
The environment is SB1s and SB3s (one of each).
I've renamed the 2 players to SB1 and SB3 for convenience in typing blind into the CLI.
If you set pitch to 90 for each player in the CLI.
Then queue a song to the SB1. That works.
Then queue a song to the SB3. That crashes the server.
I believe this is because of these lines in Squeezebox2.pm
sub maxPitch {0}
sub minPitch {0}
There are similar min and max bass and treble stubs.

I believe these stubs are unneeded because they'll be stubbed (correctly as it turns out) in Client.pm for those cases where an individual client doesn't support a function.

They should probably all go, because they are wrong (zero makes a lousy min and max, especially since the default, supplied in Player.pm, lies outside the range defined by min and max).

But there seems to be more wrong. The server fails when I queue a song to the SB3. But it's the SB1 code, not the SB3 code, which divides by zero. Why is SB1 code being run in support of an SB3?
Comment 1 Michael Wagner 2005-12-20 07:01:33 UTC
(In reply to comment #0)
> But there seems to be more wrong. The server fails when I queue a song to the
> SB3. 

I should have stopped here. The last 2 sentences are confused and confusing.

The point is, the server fails calculating pitch for an SB3. Pitch isn't supported on an SB3, but the code tries to calculate it anyways. 

It's also true that it divides by zero doing so, because max and min are set to zero, but it shouldn't even try if pitch isn't a supported function.
Comment 2 Michael Wagner 2005-12-20 07:02:34 UTC
This is related to bug 1305, only in so far as I started messing around in this area after looking over that bug in more detail.
Comment 3 KDF 2005-12-20 10:35:38 UTC
This was fixed in 6.5:
http://svn.slimdevices.com/trunk/server/Slim/Player/Squeezebox2.pm?rev=5181&r1=4978&r2=5181

same patch could be applied to 6.2.2
Comment 4 Dan Sully 2005-12-20 10:38:24 UTC
Please do.
Comment 5 Michael Wagner 2005-12-20 10:46:42 UTC
well, hang on a sec:

First off:
sub maxPitch { 50 }; 
sub minPitch { 50 }; 

should read

sub maxPitch { 100}; 
sub minPitch { 100 }; 

Secondly, are they needed at all? Aren't they already supplied correctly by client.pm?
Comment 6 KDF 2005-12-20 15:22:38 UTC
Feel free to supply the path you feel is appropriate, and that works.
Comment 7 KDF 2005-12-20 16:14:46 UTC
oh, I can actually answer that before you go back to try it out.  Had to refresh my memory.  The client module does cover this, but squeezebox2 is also a squeezebox, so would inherit at that level too.  you are correct, pitch needs to be 100 (spot my cut'n'paste).  will fix tonight.
Comment 8 KDF 2005-12-20 19:59:21 UTC
fixed at change 5424, and 6.5 tweaked for pitch at change 5423.  thanks for pointing that one out.
Comment 9 Chris Owens 2006-06-16 14:40:02 UTC
There are 536 bugs in the database with targets of '---' that were fixed prior to new year 2006.  I am setting them to targets of 6.2.1 to keep them from showing up in my queries.