Skip to content

Commit

Permalink
Add support of afl-fuzzer.
Browse files Browse the repository at this point in the history
Related issue: #333, #454

Works only with default libc:
```
$ make debug.linux -j TOOLCHAIN="./build/configs/toolchain_afl.cmake" USE_COMPILER_DEFAULT_LIBC=YES
```

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin [email protected]
  • Loading branch information
egavrin authored and sand1k committed Dec 24, 2015
1 parent 949970a commit cac1a89
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
21 changes: 21 additions & 0 deletions build/configs/toolchain_afl_i686.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include(CMakeForceCompiler)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86)

CMAKE_FORCE_C_COMPILER(afl-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(afl-g++ GNU)
23 changes: 23 additions & 0 deletions build/configs/toolchain_afl_x86_64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

include(CMakeForceCompiler)

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

CMAKE_FORCE_C_COMPILER(afl-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(afl-g++ GNU)

set(FLAGS_COMMON_ARCH -ffixed-rbp)
4 changes: 3 additions & 1 deletion jerry-core/jrt/jrt-fatals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ jerry_fatal (jerry_fatal_code_t code) /**< status code */
}
#endif /* !JERRY_NDEBUG */

if (code != 0 && jerry_is_abort_on_fail ())
if (code != 0
&& code != ERR_OUT_OF_MEMORY
&& jerry_is_abort_on_fail ())
{
abort ();
}
Expand Down

0 comments on commit cac1a89

Please sign in to comment.