File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -145,15 +145,30 @@ def decode(self, source):
145145 if len (parse ) > 1 :
146146 try :
147147 src_id += parse [1 ]
148+ if not 0 <= src_id < len (sources ):
149+ raise SourceMapDecodeError (
150+ "Segment %s references source %d; there are "
151+ "%d sources" % (segment , src_id , len (sources ))
152+ )
153+
148154 src = sources [src_id ]
149155 src_line += parse [2 ]
150156 src_col += parse [3 ]
151157
152158 if len (parse ) > 4 :
153159 name_id += parse [4 ]
160+ if not 0 <= name_id < len (names ):
161+ raise SourceMapDecodeError (
162+ "Segment %s references name %d; there are "
163+ "%d names" % (segment , name_id , len (names ))
164+ )
165+
154166 name = names [name_id ]
155167 except IndexError :
156- raise SourceMapDecodeError
168+ raise SourceMapDecodeError (
169+ "Invalid segment %s, parsed as %r"
170+ % (segment , parse )
171+ )
157172
158173 try :
159174 assert dst_line >= 0
You can’t perform that action at this time.
0 commit comments