Open
Description
Introduction
Hey, I have download codeql version 2.13.4
PS D:\luck\src> codeql --version
CodeQL command-line toolchain release 2.13.4.
Copyright (C) 2019-2023 GitHub, Inc.
Unpacked in: C:\Users\18f\Desktop\18_floor\misc_fun\codeql\codeql-win64\codeql
Analysis results depend critically on separately distributed query and
extractor modules. To list modules that are visible to the toolchain,
use 'codeql resolve qlpacks' and 'codeql resolve languages'.
and try to work it with chromium. but seems it dosen't wrok...
My OS is windows 10. and I change chromium src one file content.
gfx::Vector2dF CssPixelsToVector2dF(double x, double y, float scale_factor) { // [+] create this for codeql
return gfx::Vector2dF(x * scale_factor, y * scale_factor);
}
bool StringToGestureSourceType(Maybe<std::string> in,
content::mojom::GestureSourceType& out) {
[...]
}
I add a command in this file, so it should recompile this. with this log , it could confirm I build the database successful.
PS D:\luck\src> codeql database create D:\code_db\hunting --overwrite --language=cpp --command='autoninja -C out\hope chrome'
Initializing database at D:\code_db\hunting.
Running build command: [autoninja, -C, out\hope, chrome]
[2023-06-24 23:00:02] [build-stdout] "C:\Users\18f\Desktop\18_floor\source_code\build_chromium_tools\depot_tools\bootstrap-2@3_8_10_chromium_26_bin\python3\bin\python3.exe" C:\Users\18f\Desktop\18_floor\source_code\build_chromium_tools\depot_tools\ninja.py -C out\hope chrome -j 22
[2023-06-24 23:00:38] [build-stdout] ninja: Entering directory `out\hope'
[2023-06-24 23:00:38] [build-stdout] [1/7] CXX obj/content/browser/browser/input_handler.obj
[2023-06-24 23:00:38] [build-stdout] [2/7] STAMP obj/content/browser/browser.stamp
[2023-06-24 23:00:38] [build-stdout] [3/7] LINK(DLL) chrome.dll chrome.dll.lib chrome.dll.pdb
[2023-06-24 23:00:38] [build-stdout] [4/7] LINK initialexe/chrome.exe initialexe/chrome.exe.pdb
[2023-06-24 23:00:38] [build-stdout] [5/7] ACTION //chrome:reorder_imports(//build/toolchain/win:win_clang_x64)
[2023-06-24 23:00:38] [build-stdout] [6/7] STAMP obj/chrome/reorder_imports.stamp
[2023-06-24 23:00:38] [build-stdout] [7/7] STAMP obj/chrome/chrome.stamp
Finalizing database at D:\code_db\hunting.
Successfully created database at D:\code_db\hunting.
and then I write a query file:
import cpp
from Function risk_func
where risk_func.getQualifiedName().matches("%StringToGestureSourceType%")
//where risk_func.getAFile().getBaseName().matches("%input%") // [+] ensure the file
select risk_func, "query function"
And it returns no result...
And If I just want to query all function it still failed, like this:
import cpp
from Function risk_func
//where risk_func.getQualifiedName().matches("%StringToGestureSourceType%")
//where risk_func.getAFile().getBaseName().matches("%input%") // [+] ensure the file
select risk_func, "query function"
To see what happened , I unzip the src.zip file in the database, and I did found the function:
I attach the database, could u give me anytips which part I am wrong. thank u so much!