mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	core-util: Filter out not-a-numbers in pa_atod()
We don't and probably never will have any pa_atod() callers that would require "NaN" to be accepted, so let's filter those out in pa_atod(), instead of requiring the callers to handle not-a-numbers appropriately (which they generally forget to do).
This commit is contained in:
		
							parent
							
								
									9860bc30ac
								
							
						
					
					
						commit
						ef864eeab0
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		| 
						 | 
					@ -23,6 +23,7 @@
 | 
				
			||||||
#include <config.h>
 | 
					#include <config.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <math.h>
 | 
				
			||||||
#include <stdarg.h>
 | 
					#include <stdarg.h>
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <signal.h>
 | 
					#include <signal.h>
 | 
				
			||||||
| 
						 | 
					@ -2448,6 +2449,11 @@ int pa_atod(const char *s, double *ret_d) {
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (isnan(f)) {
 | 
				
			||||||
 | 
					        errno = EINVAL;
 | 
				
			||||||
 | 
					        return -1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    *ret_d = f;
 | 
					    *ret_d = f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue