@@ -277,12 +277,17 @@ def gdb_crash_site(python_bin, source_path, timeout=120, drop_uid=None, drop_gid
277277 ],
278278 capture_output = True ,
279279 text = True ,
280+ # The re-run prints the fuzzed program's own stdout into gdb's captured output,
281+ # which is frequently binary (e.g. a gzip/zlib vehicle emits 0x1f 0x8b ...). Decode
282+ # tolerantly so it never raises UnicodeDecodeError -- otherwise the exception would
283+ # escape decide() and abort the session's keep/rename in deinit.
284+ errors = "replace" ,
280285 timeout = timeout ,
281286 cwd = cwd ,
282287 env = {** os .environ , "ASAN_OPTIONS" : "detect_leaks=0:abort_on_error=0" },
283288 ** drop ,
284289 ).stdout
285- except (OSError , subprocess .SubprocessError ):
290+ except (OSError , ValueError , subprocess .SubprocessError ):
286291 return []
287292 return extract_sites_from_bt (out )
288293
@@ -336,22 +341,29 @@ def __init__(
336341 self .kept = collections .Counter () # bug -> directories kept
337342
338343 def _resolve (self , source_path ):
339- """Return a list of 'func@file:line' chain frames (normalising the resolver)."""
340- r = (
341- self ._resolver (source_path )
342- if self ._resolver is not None
343- else (
344- gdb_crash_site (
345- self .python_bin ,
346- source_path ,
347- self .gdb_timeout ,
348- drop_uid = self .drop_uid ,
349- drop_gid = self .drop_gid ,
344+ """Return a list of 'func@file:line' chain frames (normalising the resolver).
345+
346+ Any failure in the resolver is swallowed (-> no chain): segv resolution is a
347+ best-effort enrichment, and decide() must never raise into the caller's keep/rename.
348+ """
349+ try :
350+ r = (
351+ self ._resolver (source_path )
352+ if self ._resolver is not None
353+ else (
354+ gdb_crash_site (
355+ self .python_bin ,
356+ source_path ,
357+ self .gdb_timeout ,
358+ drop_uid = self .drop_uid ,
359+ drop_gid = self .drop_gid ,
360+ )
361+ if (self .python_bin and source_path )
362+ else None
350363 )
351- if (self .python_bin and source_path )
352- else None
353364 )
354- )
365+ except Exception :
366+ return []
355367 if not r :
356368 return []
357369 return [r ] if isinstance (r , str ) else list (r )
0 commit comments