File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -289,11 +289,12 @@ export function resolveComplexPattern(scope, ptn) {
289289 `(${ part . length } , max allowed is ${ MAX_PLACEABLE_LENGTH } )`
290290 )
291291 ) ;
292- result . push ( part . slice ( MAX_PLACEABLE_LENGTH ) ) ;
293- } else {
294- result . push ( part ) ;
292+ scope . dirty . delete ( ptn ) ;
293+ return new FluentNone ( ) ;
295294 }
296295
296+ result . push ( part ) ;
297+
297298 if ( useIsolating ) {
298299 result . push ( PDI ) ;
299300 }
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ suite('Reference bombs', function() {
1313 } ) ;
1414
1515 suite ( 'Billion Laughs' , function ( ) {
16+ this . timeout ( 10000 ) ;
17+
1618 suiteSetup ( function ( ) {
1719 bundle = new FluentBundle ( 'en-US' , { useIsolating : false } ) ;
1820 bundle . addMessages ( ftl `
@@ -30,13 +32,14 @@ suite('Reference bombs', function() {
3032 ` ) ;
3133 } ) ;
3234
33- // XXX Protect the FTL Resolver against the billion laughs attack
34- // https://bugzil.la/1307126
35- test . skip ( 'does not expand all placeables' , function ( ) {
35+ test ( 'does not expand all placeables' , function ( ) {
3636 const msg = bundle . getMessage ( 'lolz' ) ;
3737 const val = bundle . formatPattern ( msg . value , args , errs ) ;
38- assert . strictEqual ( val , '???' ) ;
39- assert . strictEqual ( errs . length , 1 ) ;
38+ assert . strictEqual (
39+ val ,
40+ '{???} {???} {???} {???} {???} {???} {???} {???} {???} {???}'
41+ ) ;
42+ assert . strictEqual ( errs . length , 10010 ) ;
4043 } ) ;
4144 } ) ;
4245} ) ;
You can’t perform that action at this time.
0 commit comments