Bug 245019 - Use 'break' instead of 'continue' in a 'do { } while (false)' loop
Summary: Use 'break' instead of 'continue' in a 'do { } while (false)' loop
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-09-09 21:09 PDT by David Kilzer (:ddkilzer)
Modified: 2022-09-12 11:04 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2022-09-09 21:09:17 PDT
Use 'break' instead of 'continue' in a 'do { } while (false)' loop.

In Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:

```
bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr<Uint8Array>& nextMessage, unsigned short& errorCode, uint32_t& systemCode)
{
    [...]

    do {
        auto rawKeysString = String::fromUTF8(rawKeysData->data(), rawKeysData->length());
        if (rawKeysString.isEmpty())  {
            LOG(Media, "CDMSessionClearKey::update(%p) - failed: empty message", this);
            continue;
        }
        [...]
    } while (false);

    [...]
}
```

Found by CodeQL.
Comment 1 Radar WebKit Bug Importer 2022-09-09 21:09:39 PDT
<rdar://problem/99770949>
Comment 2 David Kilzer (:ddkilzer) 2022-09-09 21:14:44 PDT
Pull request: https://github.com/WebKit/WebKit/pull/4213
Comment 3 EWS 2022-09-12 11:04:10 PDT
Committed 254393@main (4c4c0a117195): <https://commits.webkit.org/254393@main>

Reviewed commits have been landed. Closing PR #4213 and removing active labels.