Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] clang-format crash #1880

Closed
forunix opened this issue May 5, 2023 · 4 comments
Closed

[BUG] clang-format crash #1880

forunix opened this issue May 5, 2023 · 4 comments
Labels

Comments

@forunix
Copy link

forunix commented May 5, 2023

Description

The AES.h is from https://github.com/SergeyBel/AES/blob/master/src/AES.h
ndk version is 25.2.9519653. clang-format is under ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang-format.
Crash happened when using the clang-format to format the AES.h.

clang-format --verbose --style=file:/Users/xxx/diff/clang-format --fallback-style=Chromium -i AES.h
Formatting [1/1] AES.h
PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace.
Stack dump:
0. Program arguments: clang-format --verbose --style=file:/Users/xxx/diff/clang-format --fallback-style=Chromium -i AES.h
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
0 clang-format 0x0000000104f3b638 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 181012
1 clang-format 0x0000000104f3abac llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 178312
2 clang-format 0x0000000104f3bc54 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 182576
3 libsystem_platform.dylib 0x000000019de56a84 _sigtramp + 56
4 clang-format 0x0000000104fbb114 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 703984
5 clang-format 0x0000000104fbacec llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 702920
6 clang-format 0x0000000104fba26c llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 700232
7 clang-format 0x0000000104fb8bb0 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 694412
8 clang-format 0x0000000104fb7e18 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 690932
9 clang-format 0x0000000104f78478 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 430420
10 clang-format 0x0000000104f95028 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 548100
11 clang-format 0x0000000104f855d8 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 484020
12 clang-format 0x0000000104f72300 llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 405468
13 clang-format 0x0000000104f7293c llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 407064
14 clang-format 0x0000000104eef1f0
15 clang-format 0x0000000104eee3b8
16 dyld 0x000000019dacff28 start + 2236
zsh: bus error clang-format --verbose --style=file:/Users/xxx/diff/clang-format -i

Affected versions

r25

Canary version

No response

Host OS

Mac

Host OS version

macOS 13.3.1

Affected ABIs

arm64-v8a

Build system

CMake

Other build system

No response

minSdkVersion

NDK 25.2.9519653

Device API level

No response

@forunix forunix added the bug label May 5, 2023
@forunix
Copy link
Author

forunix commented May 5, 2023

the content of clang-format is as follows.

---
BasedOnStyle : Chromium
BinPackParameters : true
BinPackArguments: true
IndentWidth : 4
ColumnLimit : 110
AllowAllArgumentsOnNextLine : false
AllowShortFunctionsOnASingleLine: None
BreakBeforeBinaryOperators : NonAssignment
#IndentCaseLabels : false
AlignConsecutiveMacros : AcrossComments
AlignArrayOfStructures : Left
#AlignAfterOpenBracket: DontAlign
AlignAfterOpenBracket: Align
#IndentPPDirectives : BeforeHash
SeparateDefinitionBlocks: Always
IncludeBlocks : Regroup
SortIncludes: CaseSensitive
SortUsingDeclarations: true
---
Language : Cpp
AccessModifierOffset : -4
BreakBeforeBraces : Custom
BraceWrapping:
  AfterCaseLabel:  true
  AfterClass:      true
  AfterControlStatement: true
  AfterEnum:       true
  AfterFunction:   true
  AfterNamespace:  true
  AfterObjCDeclaration: true
  AfterStruct:     true
  AfterUnion:      true
  AfterExternBlock: false
  BeforeCatch:     true
  BeforeElse:      true
  IndentBraces:    false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true

IncludeCategories:
  - Regex:           '^"HLLNV[[:alnum:].]+'
    Priority:        1
  - Regex:           '^"HLLLC[[:alnum:].]+'
    Priority:        2
  - Regex:           '^"HLLME[[:alnum:].]+'
    Priority:        3
  - Regex:           '<[[:alnum:].]+>'
    Priority:        4
  - Regex:           '.*'
    Priority:        5
    SortPriority:    0
---
Language : Java

@DanAlbert
Copy link
Member

DanAlbert commented May 5, 2023

The AES.h is from https://github.com/SergeyBel/AES/blob/master/src/AES.h

Please name the exact SHA you used so this is reproducible even if we can't get to it before they change the file in a way that no longer causes a crash.

--style=file:/Users/xxx/diff/clang-format

We need that too.

@forunix
Copy link
Author

forunix commented May 6, 2023

The AES.h is from https://github.com/SergeyBel/AES/blob/master/src/AES.h

Please name the exact SHA you used so this is reproducible even if we can't get to it before they change the file in a way that no longer causes a crash.

--style=file:/Users/xxx/diff/clang-format

We need that too.

Just use the latest version of AES.h. or update to the following commit. SergeyBel/AES@deafd37

I think the crash is caused by the long array.
const unsigned char sbox[16][16] = {
{0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
0xfe, 0xd7, 0xab, 0x76},...

@DanAlbert DanAlbert changed the title [BUG] Crash [BUG] clang-format crash May 8, 2023
@pirama-arumuga-nainar
Copy link
Collaborator

This doesn't reproduce in clang-r487747 in r26. If there's another point release for r25, we can respin the toolchain with the following fix identified by bisection:

commit adfe58b09df957f8911c5e152daa9564e5931631
Author: mydeveloperday <mydeveloperday@gmail.com>
Date:   Sat Mar 12 17:21:33 2022 +0000

    [clang-format] Minimize the damage caused by AlignA
    ...
    Differential Revision: https://reviews.llvm.org/D121069

@github-project-automation github-project-automation bot moved this to Triaged in NDK r26 May 10, 2023
@github-project-automation github-project-automation bot moved this from Triaged to Merged in NDK r26 May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Merged
Development

No branches or pull requests

3 participants