Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
perl.7899
perl-pack-overflow.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-pack-overflow.diff of Package perl.7899
--- ./pp_pack.c.orig 2014-01-06 22:46:45.000000000 +0000 +++ ./pp_pack.c 2018-03-12 09:50:26.152421410 +0000 @@ -755,11 +755,28 @@ STMT_START { \ } \ } STMT_END +#define SAFE_UTF8_EXPAND(var) \ +STMT_START { \ + if ((var) > (SSize_t)(~(Size_t)0 >> 1) / UTF8_EXPAND) \ + Perl_croak(aTHX_ "%s", "Out of memory during pack()"); \ + (var) = (var) * UTF8_EXPAND; \ +} STMT_END + +#define GROWING2(utf8, cat, start, cur, item_size, item_count) \ +STMT_START { \ + if ((SSize_t)(~(Size_t)0 >> 1) / (item_size) < (item_count)) \ + Perl_croak(aTHX_ "%s", "Out of memory during pack()"); \ + GROWING((utf8), (cat), (start), (cur), (item_size) * (item_count)); \ +} STMT_END + #define GROWING(utf8, cat, start, cur, in_len) \ STMT_START { \ STRLEN glen = (in_len); \ - if (utf8) glen *= UTF8_EXPAND; \ - if ((cur) + glen >= (start) + SvLEN(cat)) { \ + STRLEN catcur = (STRLEN)((cur) - (start)); \ + if (utf8) SAFE_UTF8_EXPAND(glen); \ + if ((SSize_t)(~(Size_t)0 >> 1) - glen < catcur) \ + Perl_croak(aTHX_ "%s", "Out of memory during pack()"); \ + if (catcur + glen >= SvLEN(cat)) { \ (start) = sv_exp_grow(cat, glen); \ (cur) = (start) + SvCUR(cat); \ } \ @@ -769,7 +786,7 @@ STMT_START { \ STMT_START { \ const STRLEN glen = (in_len); \ STRLEN gl = glen; \ - if (utf8) gl *= UTF8_EXPAND; \ + if (utf8) SAFE_UTF8_EXPAND(gl); \ if ((cur) + gl >= (start) + SvLEN(cat)) { \ *cur = '\0'; \ SvCUR_set((cat), (cur) - (start)); \ @@ -2556,7 +2573,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym if (props && !(props & PACK_SIZE_UNPREDICTABLE)) { /* We can process this letter. */ STRLEN size = props & PACK_SIZE_MASK; - GROWING(utf8, cat, start, cur, (STRLEN) len * size); + GROWING2(utf8, cat, start, cur, size, (STRLEN)len); } }
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