- Fix several type comparison issues including BZ #1373601
This commit is contained in:
Patsy Franklin 2016-09-25 15:09:09 -04:00
parent e12b8361fa
commit c92a3e6ae8
4 changed files with 109 additions and 1 deletions

37
flex-max_size.patch Normal file
View File

@ -0,0 +1,37 @@
commit 3946924ed5e77420c453bf841603c7278766093a
Author: rlar <rlar>
Date: Sun Feb 28 15:20:31 2016 +0100
generated code, `max_size' seems to be of type `int', fix casts accordingly
diff --git a/src/gen.c b/src/gen.c
index 21b27ae..d31aab3 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -1875,7 +1875,7 @@ void make_tables (void)
if (!C_plus_plus) {
if (use_read) {
outn ("\terrno=0; \\");
- outn ("\twhile ( (result = (int) read( fileno(yyin), buf, max_size )) < 0 ) \\");
+ outn ("\twhile ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \\");
outn ("\t{ \\");
outn ("\t\tif( errno != EINTR) \\");
outn ("\t\t{ \\");
@@ -1891,7 +1891,7 @@ void make_tables (void)
outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
outn ("\t\t{ \\");
outn ("\t\tint c = '*'; \\");
- outn ("\t\tsize_t n; \\");
+ outn ("\t\tint n; \\");
outn ("\t\tfor ( n = 0; n < max_size && \\");
outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
outn ("\t\t\tbuf[n] = (char) c; \\");
@@ -1904,7 +1904,7 @@ void make_tables (void)
outn ("\telse \\");
outn ("\t\t{ \\");
outn ("\t\terrno=0; \\");
- outn ("\t\twhile ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \\");
+ outn ("\t\twhile ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \\");
outn ("\t\t\t{ \\");
outn ("\t\t\tif( errno != EINTR) \\");
outn ("\t\t\t\t{ \\");

19
flex-new_size.patch Normal file
View File

@ -0,0 +1,19 @@
commit 986bb5e29492a927a2ad157505c900f75c97016a
Author: rlar <rlar>
Date: Sun Feb 28 15:20:31 2016 +0100
generated code, here `new_size' is of type `int', fix casts accordingly
diff --git a/src/flex.skl b/src/flex.skl
index 2c25d21..540ce95 100644
--- a/src/flex.skl
+++ b/src/flex.skl
@@ -1782,7 +1782,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
/* Extend the array by 50%, plus the number we really need. */
int new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
- (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
+ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size M4_YY_CALL_LAST_ARG );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}

43
flex-yy_buf_size.patch Normal file
View File

@ -0,0 +1,43 @@
commit 33dd868353ab98bc33363d43be5a8b0e7e049072
Author: rlar <rlar>
Date: Sun Feb 28 15:20:31 2016 +0100
generated code, `yy_buf_size' is of type `int', fix casts accordingly
diff --git a/src/flex.skl b/src/flex.skl
index 0631725..2c25d21 100644
--- a/src/flex.skl
+++ b/src/flex.skl
@@ -1732,7 +1732,7 @@ m4_ifdef( [[M4_YY_USES_REJECT]],
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
+ (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG );
}
else
/* Can't grow it, we don't own it. */
@@ -2102,12 +2102,12 @@ static void yy_load_buffer_state YYFARGS0(void)
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
- b->yy_buf_size = (yy_size_t)size;
+ b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
- b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
+ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) M4_YY_CALL_LAST_ARG );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -2397,7 +2397,7 @@ YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = NULL;

View File

@ -3,7 +3,7 @@
Summary: A tool for creating scanners (text pattern recognizers) Summary: A tool for creating scanners (text pattern recognizers)
Name: flex Name: flex
Version: 2.6.1 Version: 2.6.1
Release: 1%{?dist} Release: 2%{?dist}
# parse.c and parse.h are under GPLv3+ with exception which allows # parse.c and parse.h are under GPLv3+ with exception which allows
# relicensing. Since flex is shipped under BDS-style license, # relicensing. Since flex is shipped under BDS-style license,
# let's assume that the relicensing was done. # let's assume that the relicensing was done.
@ -14,6 +14,9 @@ URL: https://github.com/westes/flex
Source: https://github.com/westes/flex/releases/download/v%{version}/flex-%{version}.tar.xz Source: https://github.com/westes/flex/releases/download/v%{version}/flex-%{version}.tar.xz
Patch0: flex-2.6.0-yyless.patch Patch0: flex-2.6.0-yyless.patch
Patch1: flex-max_size.patch
Patch2: flex-new_size.patch
Patch3: flex-yy_buf_size.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: m4 Requires: m4
@ -61,6 +64,9 @@ plain text and PDF formats.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build %build
%configure --docdir=%{_pkgdocdir} CFLAGS="-fPIC $RPM_OPT_FLAGS" %configure --docdir=%{_pkgdocdir} CFLAGS="-fPIC $RPM_OPT_FLAGS"
@ -133,6 +139,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_pkgdocdir} %{_pkgdocdir}
%changelog %changelog
* Sun Sep 25 2016 Patsy Franklin <pfrankli@redhat.com> - 2.6.1-2
- Fix several type comparison issues including BZ #1373601
* Tue Sep 13 2016 Rex Dieter <rdieter@fedoraproject.org> - 2.6.1-1 * Tue Sep 13 2016 Rex Dieter <rdieter@fedoraproject.org> - 2.6.1-1
- Rebase to 2.6.1 (#1318074,#1364943) - Rebase to 2.6.1 (#1318074,#1364943)
- update URL (github), drop unused patches (#1238860) - update URL (github), drop unused patches (#1238860)