* libc/stdlib/strtod.c (_strtod_r): Fix nf/nd counts to not exceed
DBL_DIG.
This commit is contained in:
		
							parent
							
								
									883ea27df0
								
							
						
					
					
						commit
						f783f223cb
					
				|  | @ -1,3 +1,8 @@ | ||||||
|  | 2011-05-16  Christian Bruel  <christian.bruel@st.com> | ||||||
|  | 
 | ||||||
|  | 	* libc/stdlib/strtod.c (_strtod_r): Fix nf/nd counts to not exceed | ||||||
|  | 	DBL_DIG. | ||||||
|  | 
 | ||||||
| 2011-05-15  Corinna Vinschen  <vinschen@redhat.com> | 2011-05-15  Corinna Vinschen  <vinschen@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	* libc/include/sys/features.h (_POSIX_THREAD_ATTR_STACKADDR): Define | 	* libc/include/sys/features.h (_POSIX_THREAD_ATTR_STACKADDR): Define | ||||||
|  |  | ||||||
|  | @ -309,8 +309,7 @@ _DEFUN (_strtod_r, (ptr, s00, se), | ||||||
|         } |         } | ||||||
| 	nd0 = nd; | 	nd0 = nd; | ||||||
| 	if (strncmp (s, _localeconv_r (ptr)->decimal_point, | 	if (strncmp (s, _localeconv_r (ptr)->decimal_point, | ||||||
| 		     strlen (_localeconv_r (ptr)->decimal_point)) == 0) | 		     strlen (_localeconv_r (ptr)->decimal_point)) == 0) { | ||||||
| 		{ |  | ||||||
| 		decpt = 1; | 		decpt = 1; | ||||||
| 		c = *(s += strlen (_localeconv_r (ptr)->decimal_point)); | 		c = *(s += strlen (_localeconv_r (ptr)->decimal_point)); | ||||||
| 		if (!nd) { | 		if (!nd) { | ||||||
|  | @ -328,21 +327,24 @@ _DEFUN (_strtod_r, (ptr, s00, se), | ||||||
|  have_dig: |  have_dig: | ||||||
| 			nz++; | 			nz++; | ||||||
| 			if (c -= '0') { | 			if (c -= '0') { | ||||||
| 				nf += nz; |  | ||||||
| 				for(i = 1; i < nz; i++) { | 				for(i = 1; i < nz; i++) { | ||||||
| 					if (nd++ <= DBL_DIG + 1) { | 					if (nd <= DBL_DIG + 1) { | ||||||
| 						if (nd < 10) | 						if (nd + i < 10) | ||||||
| 							y *= 10; | 							y *= 10; | ||||||
| 						else | 						else | ||||||
| 							z *= 10; | 							z *= 10; | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				if (nd++ <= DBL_DIG + 1) { | 				if (nd <= DBL_DIG + 1) { | ||||||
| 					if (nd < 10) | 					if (nd + i < 10) | ||||||
| 						y = 10*y + c; | 						y = 10*y + c; | ||||||
| 					else | 					else | ||||||
| 						z = 10*z + c; | 						z = 10*z + c; | ||||||
| 				} | 				} | ||||||
|  | 				if (nd <= DBL_DIG + 1) { | ||||||
|  | 					nf += nz; | ||||||
|  | 					nd += nz; | ||||||
|  | 				} | ||||||
| 				nz = 0; | 				nz = 0; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue