mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 10:36:02 +00:00
LibGfx/PortableFormat: Don't accept comments that don't start with #
This commit is contained in:
parent
9052a6febf
commit
964172754e
Notes:
sideshowbarker
2024-07-16 23:44:30 +09:00
Author: https://github.com/LucasChollet
Commit: 964172754e
Pull-request: https://github.com/SerenityOS/serenity/pull/17831
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/nico
1 changed files with 7 additions and 5 deletions
|
@ -55,18 +55,20 @@ static inline ErrorOr<u16> read_number(Streamer& streamer)
|
|||
template<typename TContext>
|
||||
static bool read_comment([[maybe_unused]] TContext& context, Streamer& streamer)
|
||||
{
|
||||
bool exist = false;
|
||||
bool is_first_char = true;
|
||||
u8 byte {};
|
||||
|
||||
while (streamer.read(byte)) {
|
||||
if (byte == '#') {
|
||||
exist = true;
|
||||
if (is_first_char) {
|
||||
if (byte != '#')
|
||||
return false;
|
||||
is_first_char = false;
|
||||
} else if (byte == '\t' || byte == '\n') {
|
||||
return exist;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return exist;
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename TContext>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue