Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Vorbis Vorbis
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Xiph.Org
  • VorbisVorbis
  • Issues
  • #234

Closed
Open
Created Aug 27, 2002 by roconnor@roconnor

divide by 0 in psy.c

In bark_noise_hybridmp we have around line 640

 if (fixed <= 0) return;

 for (i = 0, fi = 0.f; i < (fixed + 1) / 2; i++, fi += 1.f) {
   hi = i + fixed / 2;
   lo = hi - fixed;

   tN = N[hi] + N[-lo];
   tX = X[hi] - X[-lo];
   tXX = XX[hi] + XX[-lo];
   tY = Y[hi] + Y[-lo];
   tXY = XY[hi] - XY[-lo];


   A = tY * tXX - tX * tXY;
   B = tN * tXY - tX * tY;
   D = tN * tXX - tX * tX;
   R = (A + fi * B) / D;

   if (R > 0.f && R - offset < noise[i]) noise[i] = R - offset;

If fixed is 2, D can be 0, and a divide by 0 exception can be thrown.
I guess tXX has to be 0 as well.

There are probably other places where divide by 0's can occur.  This happens to
be the first I have found.

Dividing by 0 is almost always an indication of a bug.
Assignee
Assign to
Time tracking