2424enum Gis_read_stream::enum_tok_types Gis_read_stream::get_next_toc_type ()
2525{
2626 skip_space ();
27- if (!* m_cur)
27+ if (m_cur >= m_limit )
2828 return eostream;
2929 if (my_isvar_start (&my_charset_bin, *m_cur))
3030 return word;
@@ -53,7 +53,7 @@ bool Gis_read_stream::get_next_word(LEX_STRING *res)
5353 my_isvar() is a macro that would cause side effects
5454 */
5555 m_cur++;
56- while (my_isvar (&my_charset_bin, *m_cur))
56+ while ((m_cur < m_limit) && my_isvar (&my_charset_bin, *m_cur))
5757 m_cur++;
5858
5959 res->length = (uint32) (m_cur - res->str );
@@ -71,16 +71,21 @@ bool Gis_read_stream::get_next_word(LEX_STRING *res)
7171bool Gis_read_stream::get_next_number (double *d)
7272{
7373 char *endptr;
74+ int err;
7475
7576 skip_space ();
76- /* The following will also test for end \0 */
77- if ((*m_cur < ' 0' || *m_cur > ' 9' ) && *m_cur != ' -' && *m_cur != ' +' )
77+
78+ if ((m_cur >= m_limit) ||
79+ (*m_cur < ' 0' || *m_cur > ' 9' ) && *m_cur != ' -' && *m_cur != ' +' )
7880 {
7981 set_error_msg (" Numeric constant expected" );
8082 return 1 ;
8183 }
8284
83- *d = my_strtod (m_cur, &endptr);
85+ *d = my_strntod (m_charset, (char *)m_cur,
86+ m_limit-m_cur, &endptr, &err);
87+ if (err)
88+ return 1 ;
8489 if (endptr)
8590 m_cur = endptr;
8691 return 0 ;
@@ -90,7 +95,7 @@ bool Gis_read_stream::get_next_number(double *d)
9095bool Gis_read_stream::check_next_symbol (char symbol)
9196{
9297 skip_space ();
93- if (*m_cur != symbol)
98+ if ((m_cur >= m_limit) || ( *m_cur != symbol) )
9499 {
95100 char buff[32 ];
96101 strmov (buff, " '?' expected" );
0 commit comments