Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP4:FactoryCandidates
libgda
overflow-undefined-behavior.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File overflow-undefined-behavior.patch of Package libgda
From 048aa3ed2a313816ea10a4162b626ea507ac6430 Mon Sep 17 00:00:00 2001 From: Andreas Schwab <schwab@suse.de> Date: Sun, 25 Jul 2021 10:48:48 +0200 Subject: [PATCH] Fix undefined behavior due to signed integer overflow --- libgda/sql-parser/lemon.c | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libgda/sql-parser/lemon.c b/libgda/sql-parser/lemon.c index cf0f3b3eb..a6fe75bb9 100644 --- a/libgda/sql-parser/lemon.c +++ b/libgda/sql-parser/lemon.c @@ -3505,7 +3505,7 @@ void print_stack_union( int maxdtlength; /* Maximum length of any ".datatype" field. */ char *stddt; /* Standardized name for a datatype */ int i,j; /* Loop counters */ - int hash; /* For hashing the name of a type */ + unsigned int hash; /* For hashing the name of a type */ const char *name; /* Name of the parser */ /* Allocate and initialize types[] and allocate stddt[] */ @@ -3568,7 +3568,7 @@ void print_stack_union( break; } hash++; - if( hash>=arraysize ) hash = 0; + if( (int)hash>=arraysize ) hash = 0; } if( types[hash]==0 ){ sp->dtnum = hash + 1; @@ -4342,9 +4342,9 @@ int SetUnion(char *s1, char *s2) ** Code for processing tables in the LEMON parser generator. */ -PRIVATE int strhash(const char *x) +PRIVATE unsigned int strhash(const char *x) { - int h = 0; + unsigned int h = 0; while( *x) h = h*13 + *(x++); return h; } @@ -4417,8 +4417,8 @@ void Strsafe_init(){ int Strsafe_insert(const char *data) { x1node *np; - int h; - int ph; + unsigned int h; + unsigned int ph; if( x1a==0 ) return 0; ph = strhash(data); @@ -4472,7 +4472,7 @@ int Strsafe_insert(const char *data) ** if no such key. */ const char *Strsafe_find(const char *key) { - int h; + unsigned int h; x1node *np; if( x1a==0 ) return 0; @@ -4583,8 +4583,8 @@ void Symbol_init(){ int Symbol_insert(struct symbol *data, const char *key) { x2node *np; - int h; - int ph; + unsigned int h; + unsigned int ph; if( x2a==0 ) return 0; ph = strhash(key); @@ -4640,7 +4640,7 @@ int Symbol_insert(struct symbol *data, const char *key) ** if no such key. */ struct symbol *Symbol_find(const char *key) { - int h; + unsigned int h; x2node *np; if( x2a==0 ) return 0; @@ -4714,9 +4714,9 @@ PRIVATE int statecmp(struct config *a, struct config *b) } /* Hash a state */ -PRIVATE int statehash(struct config *a) +PRIVATE unsigned int statehash(struct config *a) { - int h=0; + unsigned int h=0; while( a ){ h = h*571 + a->rp->index*37 + a->dot; a = a->bp; @@ -4782,8 +4782,8 @@ void State_init(){ int State_insert(struct state *data, struct config *key) { x3node *np; - int h; - int ph; + unsigned int h; + unsigned int ph; if( x3a==0 ) return 0; ph = statehash(key); @@ -4839,7 +4839,7 @@ int State_insert(struct state *data, struct config *key) ** if no such key. */ struct state *State_find(struct config *key) { - int h; + unsigned int h; x3node *np; if( x3a==0 ) return 0; @@ -4869,9 +4869,9 @@ struct state **State_arrayof() } /* Hash a configuration */ -PRIVATE int confighash(struct config *a) +PRIVATE unsigned int confighash(struct config *a) { - int h=0; + unsigned int h=0; h = h*571 + a->rp->index*37 + a->dot; return h; } @@ -4924,8 +4924,8 @@ void Configtable_init(){ int Configtable_insert(struct config *data) { x4node *np; - int h; - int ph; + unsigned int h; + unsigned int ph; if( x4a==0 ) return 0; ph = confighash(data); @@ -4979,7 +4979,7 @@ int Configtable_insert(struct config *data) ** if no such key. */ struct config *Configtable_find(struct config *key) { - int h; + unsigned int h; x4node *np; if( x4a==0 ) return 0; -- 2.32.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor