Skip to content

Commit ef6e5f0

Browse files
committed
ci: comprehensive overflow test with detailed diagnostics
1 parent 05f50dc commit ef6e5f0

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

.github/workflows/main.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,27 +241,51 @@ jobs:
241241
- run: |
242242
# Skip regular tests for now - they're failing for unrelated reasons
243243
echo "Skipping regular tests to focus on buffer overflow detection"
244-
- name: Test for buffer overflow (Issue #1183)
244+
- name: Test for buffer overflow (Issue #1183)
245245
run: |
246246
echo "Testing for buffer overflow in json_acis_data (Issue #1183)"
247+
echo "Current commit: $(git rev-parse HEAD)"
247248
echo "Current branch: ${{ github.ref }}"
249+
echo "Checking git log:"
250+
git log --oneline | head -5
248251
echo "Checking for fix in src/in_json.c:"
249-
grep -A2 "Calculate actual required size" src/in_json.c || echo "Fix NOT found"
252+
if grep -q "Calculate actual required size" src/in_json.c; then
253+
echo "FIX IS PRESENT - This branch should NOT overflow"
254+
grep -A5 "Calculate actual required size" src/in_json.c
255+
else
256+
echo "FIX NOT FOUND - This branch SHOULD overflow"
257+
fi
250258
251259
if [ -f test/test-data/example_r14.dwg ]; then
252260
echo "Converting example_r14.dwg to JSON..."
253261
./programs/dwgread -o example_r14.json test/test-data/example_r14.dwg
254262
echo "Converting JSON back to DWG (this triggers overflow on unfixed code)..."
255-
# This should trigger buffer overflow on master, but pass on fix branch
256-
./programs/dwgwrite -o test.dwg example_r14.json 2>&1 | tee overflow_test.log
263+
# Run dwgwrite - if no fix, Fedora's FORTIFY_SOURCE will abort with overflow
264+
timeout 5 ./programs/dwgwrite -o test.dwg example_r14.json 2>&1 | tee overflow_test.log || true
257265
echo "=== Output from dwgwrite ==="
258266
cat overflow_test.log
259267
echo "=== End output ==="
260-
if grep -q "buffer overflow detected" overflow_test.log; then
261-
echo "::error::Buffer overflow detected in json_acis_data! Fix needed from PR."
262-
exit 1
268+
269+
# Check for the actual FORTIFY_SOURCE error message
270+
if grep -i "buffer overflow detected\|fortify\|stack smashing detected\|terminated" overflow_test.log; then
271+
echo "::error::Buffer overflow detected in json_acis_data! Fix needed."
272+
if grep -q "Calculate actual required size" src/in_json.c; then
273+
echo "ERROR: Fix was present but overflow still occurred!"
274+
exit 2
275+
else
276+
echo "Expected: No fix present, overflow detected correctly"
277+
exit 1
278+
fi
279+
else
280+
echo "✓ No buffer overflow detected"
281+
if grep -q "Calculate actual required size" src/in_json.c; then
282+
echo "SUCCESS: Fix present and no overflow!"
283+
exit 0
284+
else
285+
echo "WARNING: No fix but also no overflow - test may not be working"
286+
exit 0
287+
fi
263288
fi
264-
echo "✓ No buffer overflow detected"
265289
else
266290
echo "Skipping overflow test - test file not found"
267291
fi

0 commit comments

Comments
 (0)