github / github/codeql

codeql query chromium didn't work...

Đang mở
#13,552 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

## Introduction

Hey, I have download codeql version 2.13.4

``` c++
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.
``` c++
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 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.

``` c++
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:

``` c++
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...
![image](https://github.com/github/codeql/assets/135817924/b1d7f7fc-e8ae-42a1-be6d-6931acfd9c04)
And If I just want to query all function it still failed, like this:
``` c++
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:

![image](https://github.com/github/codeql/assets/135817924/cd4e8911-4817-46d2-b2a7-7ecdfb9e2dd9)

I attach the database, could u give me anytips which part I am wrong. thank u so much!

[hunting.zip](https://github.com/github/codeql/files/11857395/hunting.zip)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.