Hi, I’ve come back to the article ᕕ (ᐛ) ᕗ
recently, I’m brushing leetcode, and there’s an error report about stack
AddressSanitizer:DEADLYSIGNAL
=================================================================
==42==ERROR: AddressSanitizer: SEGV on unknown address 0x55eb765425b8 (pc 0x55eb76542b86 bp 0x7ffd1bd27d50 sp 0x7ffd1bd27d00 T0)
==42==The signal is caused by a WRITE memory access.
#2 0x7fe2bd0fe0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
AddressSanitizer can not provide additional info.
==42==ABORTING
My code is as follows
bool isValid(char * s){
bool answer;
int i=0;
char tem;
stack S=creatstack; //Something is wrong here, it should be a function but I forgot to add the brackets
while(s[i]!='\0'){
if(s[i]=='('||s[i]=='['||s[i]=='{') push(s[i],S);
else{
tem=pop(S);
if((tem=='('&&s[i]==')')||(tem=='['&&s[i]==']')||(tem=='{'&&s[i]=='}')) ;
else return false;
}
i++;
}
return true;
}
Change to
stack S=creatstack();
After that, the problem was solved
Read More:
- [Solved] OpenGL PowerVR SDK Compiling Error: Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB)
- How to Solve LeetCode Error: AddressSanitizer:DEADLYSIGNAL
- [Solved] Rocketmq console connect to x.x.x.x:10911 failed Error
- Leetcode error: AddressSanitizer:DEADLYSIGNAL [How to Solve]
- Android 10 SurfaceView Crash: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
- QT Error: ‘C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe‘ failed
- AAPT: error: attribute cardBackgroundColor (aka com.x.x:cardBackgroundColor) not found.
- Failed to remove multipath map 320b508ca45022b80 [How to Solve]
- How to Solve hadoop3.x.x sh start-dfs.sh Startup Error
- [Solved] Error response from daemon: Get “*“: x509: certificate signed by unknown authority
- package golang.org/x/net/XXX: unrecognized import path “golang.org/x/net/xxx“…
- [Solved] Error: error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
- Leetcode error: address sanitizer: detailed analysis and solution of deadlysignal
- Memory write error at 0x100000. MMU section translation fault [How to Solve]
- [Solved] C++ Error: Undefined symbols for architecture x86_64:
- [Solved] Nginx Certificate Fill Path Error: SSL: error:0200107B:system library:fopen:Unknown error:fopen
- How to Fix the printer error 0x00000709 on Windows
- [Solved] Mybatis Plus 3.X injection logic delete logicsqlinjector error
- GCC Error:(.text+0x24): undefined reference to `main‘collect2: error: ld returned 1 exit status [Solved]
- “//./root/CIMV2” because of error 0x80041003. Events cannot be delivered through this filter until t…