Skip to content

Commit f97c712

Browse files
authored
[ossfuzz][project_setup] Improve weighting of memory safe vs unsafe projects (#5135)
Fix b/477894702 The code here is broken because it doesn’t deal with new memory safe languages and also “java” language in oss-fuzz is not called java but is called jvm. The fix changes it so that languages are down weighted if not C/C++. Signed-off-by: Javan Lacerda <javanlacerda@google.com>
1 parent c97d8cc commit f97c712

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/clusterfuzz/_internal/cron/project_setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
PUBSUB_PLATFORMS = ['linux']
6767

68-
MEMORY_SAFE_LANGUAGES = {'go', 'java', 'python', 'rust'}
68+
MEMORY_UNSAFE_LANGUAGES = {'c++', 'c'}
6969
OSS_FUZZ_DEFAULT_PROJECT_CPU_WEIGHT = 1.0
7070
OSS_FUZZ_MEMORY_SAFE_LANGUAGE_PROJECT_WEIGHT = 0.2
7171

@@ -562,10 +562,10 @@ def create_project_settings(project, info, service_account):
562562
oss_fuzz_project.base_os_version = base_os_version
563563
oss_fuzz_project.put()
564564
else:
565-
if language in MEMORY_SAFE_LANGUAGES:
566-
cpu_weight = OSS_FUZZ_MEMORY_SAFE_LANGUAGE_PROJECT_WEIGHT
567-
else:
565+
if language in MEMORY_UNSAFE_LANGUAGES:
568566
cpu_weight = OSS_FUZZ_DEFAULT_PROJECT_CPU_WEIGHT
567+
else:
568+
cpu_weight = OSS_FUZZ_MEMORY_SAFE_LANGUAGE_PROJECT_WEIGHT
569569

570570
data_types.OssFuzzProject(
571571
id=project,

src/clusterfuzz/_internal/tests/appengine/handlers/cron/project_setup_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,15 @@ def test_execute(self):
247247
}),
248248
('lib2', {
249249
'homepage': 'http://example2.com',
250+
'language': 'c++',
250251
'disabled': True,
251252
'fuzzing_engines': ['libfuzzer',],
252253
}),
253254
('lib3', {
254255
'homepage':
255256
'http://example3.com',
257+
'language':
258+
'c',
256259
'sanitizers': [
257260
'address',
258261
{
@@ -281,6 +284,7 @@ def test_execute(self):
281284
}),
282285
('lib5', {
283286
'homepage': 'http://example5.com',
287+
'language': 'python',
284288
'sanitizers': ['address'],
285289
'fuzzing_engines': ['libfuzzer',],
286290
'experimental': True,
@@ -289,13 +293,15 @@ def test_execute(self):
289293
}),
290294
('lib6', {
291295
'homepage': 'http://example6.com',
296+
'language': 'rust',
292297
'sanitizers': ['address', 'memory', 'undefined'],
293298
'fuzzing_engines': ['libfuzzer', 'afl'],
294299
'auto_ccs': 'User@example.com',
295300
'vendor_ccs': ['vendor1@example.com', 'vendor2@example.com'],
296301
}),
297302
('lib7', {
298303
'homepage': 'http://example.com',
304+
'language': 'jvm',
299305
'primary_contact': 'primary@example.com',
300306
'auto_ccs': ['User@example.com',],
301307
'fuzzing_engines': ['libfuzzer',],

0 commit comments

Comments
 (0)