|
Download cpp/cpp-sanitizers-001.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 2.78 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/034ba678829a1c436b19d43dd3adab33b5170a80/cpp/cpp-sanitizers-001.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@034ba678829a1c436b19d43dd3adab33b5170a80/cpp/cpp-sanitizers-001.jsonl
-
curl -L -o cpp-sanitizers-001.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/034ba678829a1c436b19d43dd3adab33b5170a80/cpp/cpp-sanitizers-001.jsonl
2.78 kB
| {"type": "session", "harness": "opencode", "id": "cpp-sanitizers-001", "name": "C++ sanitizers comprehensive guide"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}} | |
| {"type": "message", "message": {"role": "user", "content": "Comprehensive guide to C++ sanitizers (ASan, UBSan, TSan, MSan)"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "**C++ Sanitizers Comprehensive Guide:**\n\n**1. AddressSanitizer (ASan):**\n```bash\n# Compile\ng++ -fsanitize=address -fno-omit-frame-pointer -g code.cpp\n\n# Run\n./a.out\n\n# Environment variables\nASAN_OPTIONS=detect_leaks=1 ./a.out\n```\nDetects:\n- Buffer overflow (stack, heap)\n- Use-after-free\n- Use-after-return\n- Double-free\n- Memory leaks\n\n**2. UndefinedBehaviorSanitizer (UBSan):**\n```bash\n# Compile\ng++ -fsanitize=undefined -g code.cpp\n\n# With specific checks\ng++ -fsanitize=signed-integer-overflow,null,alignment,bool,array-bounds,enum,float-cast-overflow,float-divide-by-zero,function,implicit-integer-sign-change,implicit-signed-integer-truncation,implicit-unsigned-integer-truncation,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,shift,assign,bool,enum,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,shift,bool,enum -g code.cpp\n```\nDetects:\n- Signed integer overflow\n- Null pointer dereference\n- Alignment violations\n- Out-of-bounds array access\n- Invalid shift operations\n\n**3. ThreadSanitizer (TSan):**\n```bash\n# Compile\ng++ -fsanitize=thread -g code.cpp\n\n# Run\n./a.out\n```\nDetects:\n- Data races\n- Deadlocks\n- Order violations\n\n**4. MemorySanitizer (MSan):**\n```bash\n# Compile\ng++ -fsanitize=memory -fPIE -pie -g code.cpp\n\n# Run\n./a.out\n```\nDetects:\n- Use of uninitialized memory\n\n**5. LeakSanitizer (LSan):**\n```bash\n# Compile with ASan (included)\ng++ -fsanitize=address -g code.cpp\n\n# Or standalone\nASAN_OPTIONS=detect_leaks=1 ./a.out\n```\n\n**Combining Sanitizers:**\n```bash\n# ASan + UBSan\ng++ -fsanitize=address,undefined -g code.cpp\n\n# TSan (cannot combine with ASan/MSan)\ng++ -fsanitize=thread -g code.cpp\n```\n\n**CI Integration:**\n```yaml\n# GitHub Actions\n- name: Build with sanitizers\n run: |\n g++ -fsanitize=address,undefined -fno-omit-frame-pointer -g code.cpp\n ./a.out\n env:\n ASAN_OPTIONS: detect_leaks=1\n UBSAN_OPTIONS: print_stacktrace=1\n```"}} | |