@@ -82,14 +82,12 @@ typedef struct Header {
82
82
} Header ;
83
83
84
84
85
- static int getnum (lua_State * L , const char * * fmt , int df ) {
85
+ static int getnum (const char * * fmt , int df ) {
86
86
if (!isdigit (* * fmt )) /* no number? */
87
87
return df ; /* return default value */
88
88
else {
89
89
int a = 0 ;
90
90
do {
91
- if (a > (INT_MAX / 10 ) || a * 10 > (INT_MAX - (* * fmt - '0' )))
92
- luaL_error (L , "integral size overflow" );
93
91
a = a * 10 + * ((* fmt )++ ) - '0' ;
94
92
} while (isdigit (* * fmt ));
95
93
return a ;
@@ -110,9 +108,9 @@ static size_t optsize (lua_State *L, char opt, const char **fmt) {
110
108
case 'f' : return sizeof (float );
111
109
case 'd' : return sizeof (double );
112
110
case 'x' : return 1 ;
113
- case 'c' : return getnum (L , fmt , 1 );
111
+ case 'c' : return getnum (fmt , 1 );
114
112
case 'i' : case 'I' : {
115
- int sz = getnum (L , fmt , sizeof (int ));
113
+ int sz = getnum (fmt , sizeof (int ));
116
114
if (sz > MAXINTSIZE )
117
115
luaL_error (L , "integral size %d is larger than limit of %d" ,
118
116
sz , MAXINTSIZE );
@@ -145,7 +143,7 @@ static void controloptions (lua_State *L, int opt, const char **fmt,
145
143
case '>' : h -> endian = BIG ; return ;
146
144
case '<' : h -> endian = LITTLE ; return ;
147
145
case '!' : {
148
- int a = getnum (L , fmt , MAXALIGN );
146
+ int a = getnum (fmt , MAXALIGN );
149
147
if (!isp2 (a ))
150
148
luaL_error (L , "alignment %d is not a power of 2" , a );
151
149
h -> align = a ;
0 commit comments