Vijay Rengarajan

17 papers A* 4B 4Journal 5Unranked 4
YearRankTypeTitle / Venue / Authors
2023 A* conf
CVPR
Ziyu Wan, Christian Richardt, Aljaz Bozic, Chao Li, Vijay Rengarajan, Seonghyeon Nam, Xiaoyu Xiang, Tuotuo Li, Bo Zhu, Rakesh Ranjan, Jing Liao
2023 J jnl
CoRR
Ziyu Wan, Christian Richardt, Aljaz Bozic, Chao Li, Vijay Rengarajan, Seonghyeon Nam, Xiaoyu Xiang, Tuotuo Li, Bo Zhu, Rakesh Ranjan, Jing Liao
2023 B conf
ICCP
Vishwanath Saragadam, Vijay Rengarajan, Ryuichi Tadano, Tuo Zhuang, Hideki Oyaizu, Jun Murayama, Aswin C. Sankaranarayanan
2022 conf
ECCV (18)
Xiaoyu Xiang, Yapeng Tian, Vijay Rengarajan, Lucas D. Young, Bo Zhu, Rakesh Ranjan
2022 J jnl
CoRR
Xiaoyu Xiang, Yapeng Tian, Vijay Rengarajan, Lucas D. Young, Bo Zhu, Rakesh Ranjan
2021 conf
ICCVW
Jeremy Klotz, Vijay Rengarajan, Aswin C. Sankaranarayanan
2021 J jnl
CoRR
Aswin C. Sankaranarayanan, Vishwanath Saragadam, Vijay Rengarajan, Ryuichi Tadano, Tuo Zhuang, Hideki Oyaizu, Jun Murayama
2020 conf
CVPR Workshops
Vijay Rengarajan, Shuo Zhao, Ruiwen Zhen, John William Glotzbach, Hamid R. Sheikh, Aswin C. Sankaranarayanan
2019 J jnl
CoRR
Vijay Rengarajan, Shuo Zhao, Ruiwen Zhen, John William Glotzbach, Hamid R. Sheikh, Aswin C. Sankaranarayanan
2018 B conf
ICIP
Nimisha T. M, Vijay Rengarajan, Rajagopalan Ambasamudram
2017 J jnl
IEEE Trans. Pattern Anal. Mach. Intell.
Vijay Rengarajan, Ambasamudram Narayanan Rajagopalan, Rangarajan Aravind, Guna Seetharaman
2017 A* conf
CVPR
Vijay Rengarajan, Yogesh Balaji, A. N. Rajagopalan
2016 A* conf
CVPR
Vijay Rengarajan, A. N. Rajagopalan, Rangarajan Aravind
2016 B conf
ICIP
Vijay Rengarajan, Abhijith Punnappurath, A. N. Rajagopalan, Gunasekaran S. Seetharaman
2015 A* conf
ICCV
Abhijith Punnappurath, Vijay Rengarajan, A. N. Rajagopalan
2014 conf
CVPR Workshops
Vijay Rengarajan, Abhijith Punnappurath, A. N. Rajagopalan, Guna Seetharaman
2014 B conf
ICPR
Vijay Rengarajan, A. N. Rajagopalan, Rangarajan Aravind
tests/unit/test_decompile_function_type.py
← Index tests/unit/test_decompile_function_type.py python
"""Unit tests for bninja/function_type.py."""
import sys
import pytest
from unittest.mock import MagicMock

# Install binaryninja stubs before importing
from tests.unit.conftest_binja_stubs import install_binja_stubs, SymbolType
install_binja_stubs()

from redb.extractors.decompiler.bninja.function_type import (
    FunctionType,
    FunctionTypeAnalysis,
)


# ============================================================================
# 4a. FunctionType / FunctionTypeAnalysis
# ============================================================================


class TestFunctionTypeEnum:
    def test_function_type_enum_values(self):
        assert FunctionType.USER.value == "USER"
        assert FunctionType.LIBRARY.value == "LIBRARY"
        assert FunctionType.EXTERNAL.value == "EXTERNAL"
        assert FunctionType.THUNK.value == "THUNK"
        assert FunctionType.UNKNOWN.value == "UNKNOWN"


class TestFunctionTypeAnalysis:
    def _make_function(self, symbol_type=None, is_thunk=False, raise_on_symbol=False):
        func = MagicMock()
        func.is_thunk = is_thunk
        if raise_on_symbol:
            type(func).symbol = property(lambda self: (_ for _ in ()).throw(Exception("no symbol")))
        else:
            func.symbol.type = symbol_type if symbol_type is not None else SymbolType.FunctionSymbol
        return func

    def test_user_function_type(self):
        func = self._make_function(symbol_type=SymbolType.FunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.USER

    def test_external_function_type(self):
        func = self._make_function(symbol_type=SymbolType.ImportedFunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.EXTERNAL

    def test_library_function_type(self):
        func = self._make_function(symbol_type=SymbolType.LibraryFunctionSymbol)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.LIBRARY

    def test_thunk_function_type(self):
        # Thunk overrides the symbol type
        func = self._make_function(
            symbol_type=SymbolType.FunctionSymbol, is_thunk=True
        )
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.THUNK

    def test_exception_returns_unknown(self):
        func = self._make_function(raise_on_symbol=True)
        analysis = FunctionTypeAnalysis(func)
        assert analysis.get_function_type() == FunctionType.UNKNOWN