MCPcopy
hub / github.com/google/clusterfuzz / handle_update

Function handle_update

src/appengine/handlers/external_update.py:52–132  ·  view source on GitHub ↗

Handle update.

(testcase, revision, stacktraces, error, protocol_version)

Source from the content-addressed store, hash-verified

50
51
52def handle_update(testcase, revision, stacktraces, error, protocol_version):
53 """Handle update."""
54
55 def is_still_crashing(st_index, stacktrace):
56 """Check if the the given stackstrace indicates
57 the testcase is still crashing"""
58 state = stack_analyzer.get_crash_data(
59 stacktrace,
60 fuzz_target=fuzz_target_name,
61 symbolize_flag=False,
62 already_symbolized=True,
63 detect_ooms_and_hangs=True)
64
65 crash_comparer = CrashComparer(state.crash_state, testcase.crash_state)
66 if not crash_comparer.is_similar():
67 return False
68
69 logs.info(f'State for trial {st_index} of {testcase_id} '
70 f'remains similar'
71 f'(old_state={testcase.crash_state}, '
72 f'new_state={state.crash_state}).')
73
74 is_security = crash_analyzer.is_security_issue(
75 state.crash_stacktrace, state.crash_type, state.crash_address)
76 if is_security != testcase.security_flag:
77 return False
78
79 logs.info(f'Security flag for trial {st_index} of {testcase_id} '
80 f'still matches'
81 f'({testcase.security_flag}).')
82 return True
83
84 testcase_id = testcase.key.id()
85 logs.info('Got external update for testcase.', testcase_id=testcase_id)
86 if error:
87 _mark_errored(testcase, revision, error)
88 return
89
90 last_tested_revision = (
91 testcase.get_metadata('last_tested_revision') or testcase.crash_revision)
92
93 if revision < last_tested_revision:
94 logs.warning(f'Revision {revision} less than previously tested '
95 f'revision {last_tested_revision}.')
96 return
97
98 if protocol_version not in [OLD_PROTOCOL, NEW_PROTOCOL]:
99 logs.error(f'Invalid protocol_version provided: '
100 f'{protocol_version} '
101 f'is not one of {{{OLD_PROTOCOL, NEW_PROTOCOL}}} '
102 f'(testcase_id={testcase_id}).')
103 return
104
105 if not stacktraces:
106 logs.error(f'Empty JSON stacktrace list provided '
107 f'(testcase_id={testcase_id}).')
108 return
109

Callers 1

postMethod · 0.85

Calls 7

_mark_erroredFunction · 0.85
is_still_crashingFunction · 0.85
_mark_as_fixedFunction · 0.85
errorMethod · 0.80
get_fuzz_targetMethod · 0.80
idMethod · 0.45
get_metadataMethod · 0.45

Tested by

no test coverage detected