leetcode error:
AddressSanitizer:DEADLYSIGNAL ================================================================= ==43==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00000034ca17 bp 0x7ffe82f08070 sp 0x7ffe82f07f40 T0) ==43==The signal is caused by a READ memory access. ==43==Hint: this fault was caused by a dereference of a high value address (see register values below). Dissassemble the provided pc to learn which register was used. #3 0x7f952a7800b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2) AddressSanitizer can not provide additional info. ==43==ABORTING
As you can see, the unknown address was accessed.
Reason:
The code accesses the top element of the stack for an empty stack
else if(s[i] == '}')
{
if(st.top() == '{')
{
st.pop();
}else
{
return false;
}
}
Solution:
Just join the blank judgment
else if(s[i] == '}')
{
if(!st.empty() && st.top() == '{')
{
st.pop();
}else
{
return false;
}
}
Read More:
- How to Solve LeetCode Error: AddressSanitizer:DEADLYSIGNAL
- Leetcode error: address sanitizer: detailed analysis and solution of deadlysignal
- [Solved] Leetcode Error: AddressSanitizer: SEGV on unknown address 0x55eb765425b8 (pc 0x55eb76542b86 bp 0x7ffd1bd2
- [Solved] leetcode Common Error: :runtime error: member access within misaligned address 0xbebebebebebebebe for type ‘str
- Leetcode Error: error: cannot find symbol [in __Driver__.java]
- [Solved] Hive Error: FAILED: Execution Error, return code 3 from org.apache.hadoop.hive.ql.exec.mr.MapredLocalTask
- Memory write error at 0x100000. MMU section translation fault [How to Solve]
- Git pull and Git pull origin master Warning: Pulling without specifying how to reconcile divergent branches
- [How to Solve Vue warn]: Unknown custom element: did you register the component correctly?
- error A2031: gisters not allowed [How to Solve]
- hint: Updates were rejected because the remote contains work that you do To XXX
- [Solved] Android Error: AAPT: error: unescaped apostrophe in string;Multiple substitutions specified in non-positi
- [Solved] Failed to load property source from location ‘classpath:/application.yml‘
- [Solved] kernel: nvme nvme0: I/O xxx QID xxx timeout, aborting
- [Solved] Mycat Startup Error: ERROR Startup failed: Timed out waiting for a signal from the JVM
- C++ Compile Error: error: invalid conversion from ‘void*‘ to ‘char*‘ [-fpermissive]
- [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
- [Solved] Eureka related services Start Error: cannot execute request on any known server
- Git Push Error: failed to push some refs to ‘[email protected]:
- [Solved] Illegal access: this web application instance has been stopped already