Xiaogang Qiu

63 papers A* 3B 3C 4Journal 40Unranked 13
YearRankTypeTitle / Venue / Authors
2023 J jnl
Complex Syst. Model. Simul.
Bin Chen, Runkang Guo, Zhengqiu Zhu, Chuan Ai, Xiaogang Qiu
2023 J jnl
J. Database Manag.
Rankang Li, Shanxiong Chen, Fujia Zhao, Xiaogang Qiu
2023 J jnl
IEEE Trans. Comput. Soc. Syst.
Zhengqiu Zhu, Chuan Ai, Hailiang Chen, Bin Chen, Wei Duan, Xiaogang Qiu, Xin Lu, Ming He, Zhiming Zhao, Zhong Liu
2022 J jnl
Int. J. Document Anal. Recognit.
Xiaoyu Lin, Shanxiong Chen, Fujia Zhao, Xiaogang Qiu
2022 J jnl
Int. J. Document Anal. Recognit.
Xiaoyu Lin, Shanxiong Chen, Fujia Zhao, Xiaogang Qiu
2021 J jnl
IEEE Access
Xiaogang Qiu, Shanxiong Chen, Rankang Li, Dingwang Wang, Xiaoyu Lin
2020 J jnl
Symmetry
Bin Chen, Hailiang Chen, Dandan Ning, Mengna Zhu, Chuan Ai, Xiaogang Qiu, Weihui Dai
2020 J jnl
ISPRS Int. J. Geo Inf.
Chuan Ai, Bin Chen, Hailiang Chen, Weihui Dai, Xiaogang Qiu
2020 J jnl
Int. J. Model. Simul. Sci. Comput.
Zhen Li, Bin Chen, Xiaocheng Liu, Dandan Ning, Xiaogang Qiu
2020 J jnl
Symmetry
Bin Chen, Yiduo Wang, Rongxiao Wang, Zhengqiu Zhu, Liang Ma, Xiaogang Qiu, Weihui Dai
2019 J jnl
ISPRS Int. J. Geo Inf.
Jian Dong, Bin Chen, Lingnan He, Chuan Ai, Fang Zhang, Danhuai Guo, Xiaogang Qiu
2019 conf
EM-GIS
Yong Zhao, Bin Chen, Zhengqiu Zhu, Rongxiao Wang, Hailiang Chen, Xiaogang Qiu
2019 J jnl
Reliab. Eng. Syst. Saf.
Lao-bing Zhang, Genserik Reniers, Bin Chen, Xiaogang Qiu
2019 J jnl
IEEE Access
Jian Dong, Bin Chen, Chuan Ai, Pengfei Zhang, Xiaogang Qiu, Lingnan He
2019 J jnl
Entropy
Jian Dong, Bin Chen, Pengfei Zhang, Chuan Ai, Fang Zhang, Danhuai Guo, Xiaogang Qiu
2019 J jnl
Reliab. Eng. Syst. Saf.
Laobing Zhang, Genserik Reniers, Xiaogang Qiu
2018 J jnl
Symmetry
Zhen Li, Bin Chen, Xiaocheng Liu, Dandan Ning, Qihang Wei, Yiping Wang, Xiaogang Qiu
2018 conf
DSC
Chuan Ai, Bin Chen, Liang Liu, Jian Dong, Lingnan He, Xiaogang Qiu
2018 conf
EM-GIS@SIGSPATIAL
Zhengqiu Zhu, Bin Chen, Feiran Chen, Rongxiao Wang, Liang Ma, Xiaogang Qiu
2018 conf
EM-GIS@SIGSPATIAL
Rongxiao Wang, Bin Chen, Yiduo Wang, Zhengqiu Zhu, Liang Ma, Xiaogang Qiu
2018 J jnl
ISPRS Int. J. Geo Inf.
Liang Liu, Bin Chen, Chuan Ai, Lingnan He, Yiping Wang, Xiaogang Qiu, Xin Lu
2018 J jnl
GeoInformatica
Chuan Ai, Bin Chen, Lingnan He, Kaisheng Lai, Xiaogang Qiu
2017 J jnl
Int. J. Model. Simul. Sci. Comput.
Liang Ma, Bin Chen, Sihang Qiu, Zhen Li, Xiaogang Qiu
2017 conf
DSC
Liang Liu, Bin Chen, Bo Qu, Lingnan He, Xiaogang Qiu
2017 conf
BESC
Liang Liu, Bin Chen, Wangchun Jiang, Xiaogang Qiu, Lingnan He, Kaisheng Lai
2017 B conf
SMC
Jian Dong, Wei Duan, Bin Chen, Xiaogang Qiu, Xiangyu Wei
2017 C conf
DS-RT
Zhen Li, Bin Chen, Xiaocheng Liu, Dandan Ning, Wei Duan, Xiaogang Qiu, Chengda Xu
2017 C conf
DS-RT
Rongxiao Wang, Bin Chen, Sihang Qiu, Zhengqiu Zhu, Liang Ma, Xiaogang Qiu, Wei Duan
2017 conf
EM-GIS
Zhengqiu Zhu, Bin Chen, Sihang Qiu, Rongxiao Wang, Liang Ma, Xiaogang Qiu
2017 conf
EM-GIS
Chuan Ai, Bin Chen, Lingnan He, Kaisheng Lai, Xiaogang Qiu, Liang Liu
2016 J jnl
Int. J. Autom. Comput.
Zhichao Song, Yuanzheng Ge, Hong Duan, Xiaogang Qiu
2016 conf
APWeb Workshops
Wangchun Jiang, Bin Chen, Lingnan He, Yichong Bai, Xiaogang Qiu
2016 J jnl
J. Artif. Soc. Soc. Simul.
Mingxin Zhang, Alexander Verbraeck, Rongqing Meng, Bin Chen, Xiaogang Qiu
2016 conf
AsiaSim/SCS AutumnSim (1)
Zhen Li, Gang Guo, Bin Chen, Liang Ma, Yuyu Luo, Xiaogang Qiu
2016 J jnl
Int. J. Model. Simul. Sci. Comput.
Zhichao Song, Rongqing Meng, Hong Duan, Xiaogang Qiu
2015 J jnl
IEEE Intell. Syst.
Rongqing Meng, Yuanzheng Ge, Zhidong Cao, Xiaogang Qiu, Kedi Huang
2015 J jnl
Comput. Sci. Inf. Syst.
Zongchen Fan, Xiaogang Qiu, Weihui Dai, Yuanzheng Ge, Liang Liu, Yunsuo Duan
2015 C conf
DS-RT
Zhen Li, Gang Guo, Bin Chen, Xiaogang Qiu
2015 conf
SIGSIM-PADS
Mingxin Zhang, Alexander Verbraeck, Rongqing Meng, Xiaogang Qiu
2015 J jnl
Comput. Intell. Neurosci.
Xin Zhou, Bin Chen, Liang Liu, Liang Ma, Xiaogang Qiu
2015 J jnl
Frontiers Comput. Sci.
Wei Duan, Zongchen Fan, Peng Zhang, Gang Guo, Xiaogang Qiu
2015 J jnl
Comput. Intell. Neurosci.
Peng Zhang, Bin Chen, Liang Ma, Zhen Li, Zhichao Song, Wei Duan, Xiaogang Qiu
2014 J jnl
IEEE Trans. Fuzzy Syst.
Shan Mei, Yifan Zhu, Xiaogang Qiu, Xuan Zhou, Zhenghu Zu, Alexander Boukhanovsky, Peter M. A. Sloot
2014 J jnl
Simul.
Yuanzheng Ge, Rongqing Meng, Zhidong Cao, Xiaogang Qiu, Kedi Huang
2013 J jnl
Simul.
Yuanzheng Ge, Liang Liu, Xiaogang Qiu, Hongbin Song, Yong Wang, Kedi Huang
2013 J jnl
IEEE Trans. Syst. Man Cybern. Syst.
Wei Duan, Zhidong Cao, Youzhong Wang, Bin Zhu, Daniel Zeng, Fei-Yue Wang, Xiaogang Qiu, Hongbin Song, Yong Wang
2013 J jnl
IEEE Intell. Syst.
Wei Duan, Xiaogang Qiu, Zhidong Cao, Xiaolong Zheng, Kainan Cui
2013 J jnl
Int. J. Model. Simul. Sci. Comput.
Gang Guo, Bin Chen, Xiaogang Qiu
2013 J jnl
IEEE Intell. Syst.
Sharad Mehrotra, Xiaogang Qiu, Zhidong Cao, Austin Tate
2012 C conf
CLUSTER
Xiaocheng Liu, Chen Wang, Xiaogang Qiu, Bing Bing Zhou, Bin Chen, Albert Y. Zomaya
2012 B conf
PADS
Xiaocheng Liu, Xiaogang Qiu, Bin Chen, Kedi Huang
2012 J jnl
Simul. Model. Pract. Theory
Xiaocheng Liu, Qiang He, Xiaogang Qiu, Bin Chen, Kedi Huang
2012 J jnl
Frontiers Comput. Sci.
Wei Duan, Xiaogang Qiu
2012 B conf
PADS
Gang Guo, Bin Chen, Xiaogang Qiu, Zhen Li
2011 J jnl
IEEE Trans. Intell. Transp. Syst.
Qinghai Miao, Fenghua Zhu, Yisheng Lv, Changjian Cheng, Cheng Chen, Xiaogang Qiu
2011 conf
PAISI
Wei Duan, Zhidong Cao, Yuanzheng Ge, Xiaogang Qiu
2010 conf
FCST
Wei Duan, Yuanzheng Ge, Xiaogang Qiu
2008 J jnl
IEEE Trans. Computers
Xiaogang Qiu, Michel Dubois
2005 J jnl
IEEE Trans. Parallel Distributed Syst.
Xiaogang Qiu, Michel Dubois
2004 J jnl
IEEE Trans. Computers
Xiaogang Qiu, Michel Dubois
2001 A* conf
HPCA
Xiaogang Qiu, Michel Dubois
1999 A* conf
ISCA
Xiaogang Qiu, Michel Dubois
1998 A* conf
ISCA
Xiaogang Qiu, Michel Dubois
tests/unit/test_decompile_decompiler.py
← Index tests/unit/test_decompile_decompiler.py python
"""Unit tests (mocked BN) for bninja/decompiler.py — BinaryNinjaDecompiler."""
import sys
import json
import time
import pytest
from unittest.mock import MagicMock, patch, mock_open

from tests.unit.conftest_binja_stubs import (
    install_binja_stubs,
    MockFunction,
    MockBasicBlock,
    MockDisassemblyLine,
    MockToken,
    MockSymbol,
    MockBinaryView,
    MockEdge,
    SymbolType,
    InstructionTextTokenType,
    BranchType,
)

install_binja_stubs()

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


# ============================================================================
# 10a. BinaryNinjaDecompiler
# ============================================================================


class TestBinaryNinjaDecompilerLogError:
    def _make_decompiler(self):
        with patch.object(BinaryNinjaDecompiler, "__init__", lambda self, *a, **kw: None):
            d = BinaryNinjaDecompiler.__new__(BinaryNinjaDecompiler)
            d.log = MagicMock()
            d.errors = []
            d.filepath = "/fake/binary"
            d.bv = None
            d.analysis_results = None
            d.exporters = []
            d.index_prefix = None
            d.filetype = None
            d.goresym = None
            d.BNINJA_TIMEOUT = 60
            return d

    def test_log_error_appends(self):
        d = self._make_decompiler()
        d.log_error("test error", "func1", 0x1000, Exception("boom"), "extract")
        assert len(d.errors) == 1

    def test_log_error_schema(self):
        d = self._make_decompiler()
        d.log_error("test error", "func1", 0x1000, Exception("boom"), "extract")
        error = d.errors[0]
        expected_keys = [
            "function_name",
            "function_address",
            "error_location",
            "error_message",
            "error_details",
            "error_type",
            "timestamp",
        ]
        for key in expected_keys:
            assert key in error, f"Missing key: {key}"


class TestBinaryNinjaDecompilerIsTooFewBlocks:
    def _make_decompiler(self):
        with patch.object(BinaryNinjaDecompiler, "__init__", lambda self, *a, **kw: None):
            d = BinaryNinjaDecompiler.__new__(BinaryNinjaDecompiler)
            d.log = MagicMock()
            d.errors = []
            d.MIN_FUNCTION_SIZE = 10
            return d

    def test_is_too_few_blocks_none(self):
        d = self._make_decompiler()
        func = MagicMock()
        func.basic_blocks = None
        assert d.is_too_few_blocks(func) is False

    def test_is_too_few_blocks_empty(self):
        # Empty basic_blocks now returns True because Binja creates function
        # stubs with empty blocks before analysis completes — we no longer
        # skip these so they get filtered downstream instead.
        d = self._make_decompiler()
        func = MagicMock()
        func.basic_blocks = []
        assert d.is_too_few_blocks(func) is True

    def test_is_too_few_blocks_small_single(self):
        d = self._make_decompiler()
        block = MagicMock()
        block.disassembly_text = [MagicMock() for _ in range(5)]  # < 10
        func = MagicMock()
        func.basic_blocks = [block]
        assert d.is_too_few_blocks(func) is False

    def test_is_too_few_blocks_large_single(self):
        d = self._make_decompiler()
        block = MagicMock()
        block.disassembly_text = [MagicMock() for _ in range(15)]  # >= 10
        func = MagicMock()
        func.basic_blocks = [block]
        assert d.is_too_few_blocks(func) is True

    def test_is_too_few_blocks_multiple(self):
        d = self._make_decompiler()
        func = MagicMock()
        func.basic_blocks = [MagicMock(), MagicMock()]
        assert d.is_too_few_blocks(func) is True


class TestIsLibOrThunk:
    def test_is_lib_or_thunk_user(self):
        func = MagicMock()
        func.symbol.type = SymbolType.FunctionSymbol
        func.is_thunk = False
        assert is_lib_or_thunk(func) is True  # NOT filtered

    def test_is_lib_or_thunk_thunk(self):
        func = MagicMock()
        func.symbol.type = SymbolType.FunctionSymbol
        func.is_thunk = True
        assert is_lib_or_thunk(func) is False  # Filtered out

    def test_is_lib_or_thunk_external(self):
        func = MagicMock()
        func.symbol.type = SymbolType.ImportedFunctionSymbol
        func.is_thunk = False
        assert is_lib_or_thunk(func) is False  # Filtered out


class TestBinaryNinjaDecompilerExtract:
    def _make_decompiler(self):
        with patch.object(BinaryNinjaDecompiler, "__init__", lambda self, *a, **kw: None):
            d = BinaryNinjaDecompiler.__new__(BinaryNinjaDecompiler)
            d.log = MagicMock()
            d.errors = []
            d.filepath = "/fake/binary"
            d.bv = MagicMock()
            d.analysis_results = None
            d.exporters = []
            d.index_prefix = None
            d.filetype = None
            d.goresym = None
            d.BNINJA_TIMEOUT = 60
            d.arch = MagicMock()
            return d

    def test_extract_success(self):
        d = self._make_decompiler()
        mock_results = {
            "decompiled": [{"test": True}],
            "disassembled": [],
            "cfg": [],
            "llil": [],
            "errors": [],
            "strings": [],
            "mlil": [],
        }
        with patch.object(d, "analyze_binary", return_value=mock_results):
            result = d.extract()
            assert result is True
            assert d.analysis_results == mock_results

    def test_extract_failure(self):
        d = self._make_decompiler()
        with patch.object(d, "analyze_binary", return_value=None):
            result = d.extract()
            assert result is False

    def test_tag(self):
        d = self._make_decompiler()
        assert d.tag() == "DECOMPILED"


class TestBinaryNinjaDecompilerAnalyzeBinary:
    def _make_decompiler(self):
        with patch.object(BinaryNinjaDecompiler, "__init__", lambda self, *a, **kw: None):
            d = BinaryNinjaDecompiler.__new__(BinaryNinjaDecompiler)
            d.log = MagicMock()
            d.errors = []
            d.filepath = "/fake/binary"
            d.analysis_results = None
            d.exporters = []
            d.index_prefix = None
            d.filetype = None
            d.goresym = None
            d.BNINJA_TIMEOUT = 60
            d.arch = MagicMock()
            d.MIN_FUNCTION_SIZE = 10
            return d

    def test_analyze_binary_links_hlil_disasm(self):
        """Bi-directional hash linkage between decompiled and disassembled."""
        d = self._make_decompiler()
        d.bv = MagicMock()
        d.bv.functions = []
        # Mock methods to return controlled data
        with patch.object(d, "extract_hlil") as mock_hlil, \
             patch.object(d, "extract_disasm") as mock_disasm, \
             patch.object(d, "extract_cfg", return_value=None), \
             patch.object(d, "extract_lowlevel", return_value=None):

            mock_hlil.return_value = {
                "decompiled_function_hash": "HLIL_HASH",
                "decompiled_function_name": "test",
                "decompiled_function": "code",
            }
            mock_disasm.return_value = {
                "disassembled_function_hash": "DISASM_HASH",
                "disassembled_function_no_addresses": "asm",
            }

            # Manually feed one function
            mock_func = MagicMock()
            mock_func.symbol.type = SymbolType.FunctionSymbol
            mock_func.is_thunk = False
            mock_func.basic_blocks = [MagicMock(), MagicMock()]
            d.bv.functions = [mock_func]

            results = d.analyze_binary()
            if results and results["decompiled"]:
                hlil_r = results["decompiled"][0]
                disasm_r = results["disassembled"][0]
                assert hlil_r["disassembled_function_hash"] == "DISASM_HASH"
                assert disasm_r["decompiled_function_hash"] == "HLIL_HASH"

    def test_analyze_binary_links_llil_disasm(self):
        """Bi-directional linkage between LLIL and disassembly."""
        d = self._make_decompiler()
        d.bv = MagicMock()

        with patch.object(d, "extract_hlil", return_value=None), \
             patch.object(d, "extract_disasm") as mock_disasm, \
             patch.object(d, "extract_cfg", return_value=None), \
             patch.object(d, "extract_lowlevel") as mock_llil:

            mock_disasm.return_value = {
                "disassembled_function_hash": "DISASM_HASH",
                "disassembled_function_no_addresses": "asm",
            }
            mock_llil.return_value = {
                "sha256_llil": "LLIL_HASH",
                "tlsh_llil": "tlsh_val",
            }

            mock_func = MagicMock()
            mock_func.symbol.type = SymbolType.FunctionSymbol
            mock_func.is_thunk = False
            mock_func.basic_blocks = [MagicMock(), MagicMock()]
            d.bv.functions = [mock_func]

            results = d.analyze_binary()
            if results and results["llil"]:
                llil_r = results["llil"][0]
                assert llil_r["disassembled_function_hash"] == "DISASM_HASH"

    def test_analyze_binary_links_cfg_disasm(self):
        """CFG gets disassembled_function_hash."""
        d = self._make_decompiler()
        d.bv = MagicMock()

        with patch.object(d, "extract_hlil", return_value=None), \
             patch.object(d, "extract_disasm") as mock_disasm, \
             patch.object(d, "extract_cfg") as mock_cfg, \
             patch.object(d, "extract_lowlevel", return_value=None):

            mock_disasm.return_value = {
                "disassembled_function_hash": "DISASM_HASH",
                "disassembled_function_no_addresses": "asm",
            }
            mock_cfg.return_value = {
                "function_address": 0x1000,
                "cyclomatic_complexity": 3,
            }

            mock_func = MagicMock()
            mock_func.symbol.type = SymbolType.FunctionSymbol
            mock_func.is_thunk = False
            mock_func.basic_blocks = [MagicMock(), MagicMock()]
            d.bv.functions = [mock_func]

            results = d.analyze_binary()
            if results and results["cfg"]:
                cfg_r = results["cfg"][0]
                assert cfg_r["disassembled_function_hash"] == "DISASM_HASH"

    def test_analyze_binary_sets_cyclomatic(self):
        """cyclomatic_complexity set on disasm from CFG."""
        d = self._make_decompiler()
        d.bv = MagicMock()

        with patch.object(d, "extract_hlil", return_value=None), \
             patch.object(d, "extract_disasm") as mock_disasm, \
             patch.object(d, "extract_cfg") as mock_cfg, \
             patch.object(d, "extract_lowlevel", return_value=None):

            mock_disasm.return_value = {
                "disassembled_function_hash": "HASH",
                "disassembled_function_no_addresses": "asm",
            }
            mock_cfg.return_value = {
                "function_address": 0x1000,
                "cyclomatic_complexity": 7,
            }

            mock_func = MagicMock()
            mock_func.symbol.type = SymbolType.FunctionSymbol
            mock_func.is_thunk = False
            mock_func.basic_blocks = [MagicMock(), MagicMock()]
            d.bv.functions = [mock_func]

            results = d.analyze_binary()
            if results and results["disassembled"]:
                disasm_r = results["disassembled"][0]
                assert disasm_r.get("cyclomatic_complexity") == 7


class TestApplyGoReSym:
    def _make_decompiler(self):
        with patch.object(BinaryNinjaDecompiler, "__init__", lambda self, *a, **kw: None):
            d = BinaryNinjaDecompiler.__new__(BinaryNinjaDecompiler)
            d.log = MagicMock()
            d.errors = []
            d.bv = MagicMock()
            return d

    def test_apply_goresym_user_functions(self):
        d = self._make_decompiler()
        d.goresym = "/tmp/goresym.json"
        data = {
            "UserFunctions": [{"Start": 0x1000, "FullName": "main.main"}],
        }
        with patch("builtins.open", mock_open(read_data=json.dumps(data))):
            d._BinaryNinjaDecompiler__apply_goresym()
            d.bv.define_user_symbol.assert_called()

    def test_apply_goresym_std_functions(self):
        d = self._make_decompiler()
        d.goresym = "/tmp/goresym.json"
        data = {
            "StdFunctions": [{"Start": 0x2000, "FullName": "runtime.main"}],
        }
        with patch("builtins.open", mock_open(read_data=json.dumps(data))):
            d._BinaryNinjaDecompiler__apply_goresym()
            d.bv.define_user_symbol.assert_called()

    def test_apply_goresym_invalid_json(self):
        d = self._make_decompiler()
        d.goresym = "/tmp/goresym.json"
        with patch("builtins.open", mock_open(read_data="not json {")):
            d._BinaryNinjaDecompiler__apply_goresym()
            # Should log error but not crash
            d.log.log_error if hasattr(d.log, 'log_error') else None
            # Just verify no exception raised