Skip to content

test: add debug to check failure on macos#1399

Closed
alfredh wants to merge 5 commits intomainfrom
test_srtp_loop
Closed

test: add debug to check failure on macos#1399
alfredh wants to merge 5 commits intomainfrom
test_srtp_loop

Conversation

@alfredh
Copy link
Contributor

@alfredh alfredh commented Aug 12, 2025

currently a bug with macos-latest:

.... test_srtp_loop: offset=0, suite=0 seq=3
.... test_srtp_loop: offset=0, suite=1 seq=3
.... test_srtp_loop: offset=0, suite=2 seq=3
.... test_srtp_loop: offset=0, suite=3 seq=3
.... test_srtp_loop: offset=4, suite=0 seq=3
.... test_srtp_loop: offset=4, suite=1 seq=3
.... test_srtp_loop: offset=0, suite=0 seq=65530

srtptest: TEST_MEMCMP: /Users/runner/work/re/re/test/srtp.c:403: test_srtp_loop(): failed

Offset:   Expected (20 bytes):       Actual (20 bytes):
0x0000    55 55 55 55 11 11 11 11     d6 0f 54 17 33 59 64 c8
0x0008    ee ee ee ee 11 11 11 11     6e 21 b5 6b 5a 6f 26 d5
0x0010    55 55 55 55                 cb a9 24 fd            

The index calculation is wrong:

.... test_srtp_loop: offset=0, suite=0 seq=65530
.... srtp_encrypt:  seq=65530  roc=0  ix=65530
.... srtp_decrypt:  seq=65530  roc=0  ix=131066

The calculated ix in srtp_decrypt should be the same as encrypt, i.e. 65530

relevant code:

/*
 * Appendix A: Pseudocode for Index Determination
 *
 * In the following, signed arithmetic is assumed.
 */
uint64_t srtp_get_index(uint32_t roc, uint16_t s_l, uint16_t seq)
{
	int v;

	if (s_l < 32768) {

		if ((int)seq - (int)s_l > 32768)
			v = (roc-1) & 0xffffffffu;
		else
			v = roc;
	}
	else {
		if ((int)s_l - 32768 > seq)
			v = (roc+1) & 0xffffffffu;
		else
			v = roc;
	}

	return seq + v*(uint64_t)65536;
}

@alfredh alfredh marked this pull request as draft August 12, 2025 09:03
@sreimers
Copy link
Member

Not sure but maybe we had something already in the past. It was a macOS clang compiler bug, i think.

@sreimers
Copy link
Member

@sreimers
Copy link
Member

sreimers commented Aug 12, 2025

Yes, the compiler is (clang-1600.0.26.3) the bug is fixed with: clang-1600.0.26.6, not sure why github uses a outdated compiler for macos now.

@sreimers
Copy link
Member

Fixed by: #1400

@alfredh
Copy link
Contributor Author

alfredh commented Aug 12, 2025

This was caused by a buggy compiler, closing the issue ...

@alfredh alfredh closed this Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants