mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-03 18:20:25 +02:00 
			
		
		
		
	ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_time()
This function is called from load_guspatch() and the rate is specified by the user. If they accidentally selected zero then it would crash the kernel. I've just changed the zero to a one. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									17b89c8031
								
							
						
					
					
						commit
						2854cd34fb
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -856,6 +856,8 @@ calc_gus_envelope_time(int rate, int start, int end)
 | 
				
			||||||
	int r, p, t;
 | 
						int r, p, t;
 | 
				
			||||||
	r = (3 - ((rate >> 6) & 3)) * 3;
 | 
						r = (3 - ((rate >> 6) & 3)) * 3;
 | 
				
			||||||
	p = rate & 0x3f;
 | 
						p = rate & 0x3f;
 | 
				
			||||||
 | 
						if (!p)
 | 
				
			||||||
 | 
							p = 1;
 | 
				
			||||||
	t = end - start;
 | 
						t = end - start;
 | 
				
			||||||
	if (t < 0) t = -t;
 | 
						if (t < 0) t = -t;
 | 
				
			||||||
	if (13 > r)
 | 
						if (13 > r)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue