File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ module LD
9191 array_nl : "\n "
9292 )
9393
94+ MAX_CONTEXTS_LOADED = 50
95+
9496 class JsonLdError < StandardError
9597 def to_s
9698 "#{ self . class . instance_variable_get :@code } : #{ super } "
@@ -134,6 +136,7 @@ class InvalidVocabMapping < JsonLdError; @code = "invalid vocab mapping"; end
134136 class KeywordRedefinition < JsonLdError ; @code = "keyword redefinition" ; end
135137 class LoadingDocumentFailed < JsonLdError ; @code = "loading document failed" ; end
136138 class LoadingRemoteContextFailed < JsonLdError ; @code = "loading remote context failed" ; end
139+ class ContextOverflow < JsonLdError ; @code = "maximum number of @context URLs exceeded" ; end
137140 class MultipleContextLinkHeaders < JsonLdError ; @code = "multiple context link headers" ; end
138141 class ProcessingModeConflict < JsonLdError ; @code = "processing mode conflict" ; end
139142 class RecursiveContextInclusion < JsonLdError ; @code = "recursive context inclusion" ; end
Original file line number Diff line number Diff line change @@ -419,6 +419,7 @@ def parse(local_context, remote_contexts = [])
419419
420420 raise JsonLdError ::RecursiveContextInclusion , "#{ context } " if remote_contexts . include? ( context . to_s )
421421 remote_contexts << context . to_s
422+ raise JsonLdError ::ContextOverflow , "#{ context } " if remote_contexts . length >= MAX_CONTEXTS_LOADED
422423
423424 context_no_base = result . dup
424425 context_no_base . base = nil
You can’t perform that action at this time.
0 commit comments