Commit graph

21490 commits

Author SHA1 Message Date
Maciej Zygmanowski 104dc93220 ifconfig: Use shorter argument names
The previous argument names were so long that they won't fit
into the terminal, making help message unreadable.
2021-06-05 23:51:08 +04:30
Timothy Flynn f8f36effc9 LibSQL: Limit the allowed depth of an expression tree
According to the definition at https://sqlite.org/lang_expr.html, SQL
expressions could be infinitely deep. For practicality, SQLite enforces
a maxiumum expression tree depth of 1000. Apply the same limit in
LibSQL to avoid stack overflow in the expression parser.

Fixes https://crbug.com/oss-fuzz/34859.
2021-06-05 23:48:18 +04:30
Linus Groh 3d9bcb860e CI: Run libjs-test262 and update results on every push to master 2021-06-05 19:27:55 +01:00
Idan Horowitz 442ef63008 LibJS: Add the global escape() & unescape() methods 2021-06-05 18:55:08 +01:00
Idan Horowitz e2fb7943f7 LibJS: Correctly handle NaN and negative infinity in Math.atan2
The current implementation was missing an early return on a NaN
argument and mixed up a couple of the positive/negative infinity early
returns.
2021-06-05 14:56:58 +01:00
Idan Horowitz 57a52094d1 LibJS: Rewrite Math.hypot to handle exceptions, NaNs, Infinity properly
The specification requires that we immediately return Infinity during
the iteration over the arguments if positive or negative infinity is
encountered, and return a NaN if it is encountered and no Infinity was
found. The specification also requires all arguments to be coerced into
numbers before the operation starts, or else a number conversion
exception could be missed due to the Infinity/NaN early return.
2021-06-05 14:56:58 +01:00
Idan Horowitz 03255c1c53 LibJS: Handle NaN/Infinity/Zero edge cases in Math.pow()
This commit replaces the current simple call to LibM's pow with the
full implementation of 6.1.6.1.3 Number::exponentiate:
https://tc39.es/ecma262/#sec-numeric-types-number-exponentiate
2021-06-05 14:56:58 +01:00
Idan Horowitz 7507999230 LibJS: Rewrite Math.{max, min} to handle exceptions and NaNs properly
The specification requires that we immediately return a NaN during the
iteration over the arguments if one is encountered. It also requires
all arguments to be coerced into numbers before the operation starts,
or else a number conversion exception could be missed due to the NaN
early return.
2021-06-05 14:56:58 +01:00
Idan Horowitz 24ffe91b16 LibJS: Handle negative zero and negative infinity in Math.abs()
As required by the specification:
3. If n is -0, return +0.
4. If n is -∞, return +∞.
2021-06-05 14:56:58 +01:00
Idan Horowitz 9d2e90d569 LibJS: Add Math.imul() 2021-06-05 14:56:58 +01:00
Idan Horowitz de10f0dc6c LibJS: Support symbol keys in Object.prototype.propertyIsEnumerable 2021-06-05 14:15:28 +01:00
Idan Horowitz eb0b1c432a LibJS: Replace StringOrSymbol::from_value with Value::to_property_key
This is a more specification compliant implementation of the
abstract operation 7.1.19 ToPropertyKey which should handle boxed
symbols correctly.
2021-06-05 14:15:28 +01:00
Jelle Raaijmakers e72e621d89 Ports/PHP: Enable OpenSSL extension 2021-06-05 13:02:13 +02:00
Jelle Raaijmakers fccba571a2 Ports/PHP: Disable PCRE JIT
The PCRE JIT creates memory that needs to be readable, writable and
executable at the same time. Serenity does not like this, so disable
it. This JIT is of limited use for the current applications of PHP
within Serenity anyway :-)
2021-06-05 13:02:13 +02:00
Jelle Raaijmakers 012a5b145b Ports/PHP: Enable Zlib extension 2021-06-05 13:02:13 +02:00
Jelle Raaijmakers 64e2e2cff3 Ports/PHP: Enable Phar extension 2021-06-05 13:02:13 +02:00
Daniel Bertalan 169e93f0a7 Kernel: Perform output processing on echo
Previously, we would echo characters back just as they were passed to
us, even in canonical mode. This caused newlines to not work correctly
in some programs.

Fixes #7802
2021-06-05 13:01:39 +02:00
Andreas Kling 42fcc2219d LibJS: Use PropertyName::as_string() in Object::get()
After we've already checked is_string(), we can use as_string() to
avoid a temporary String.
2021-06-05 13:00:34 +02:00
Andreas Kling 66f15c2e0c AK: Always inline FlyString::view() 2021-06-05 12:36:14 +02:00
Sahan Fernando d02e7b3811 LibWasm: Move Wasm::BytecodeInterpreter into its own header 2021-06-05 14:31:54 +04:30
Marcus Nilsson 94551149d1 TreeView: Don't try to move cursor with invalid index
When clicking on the TreeView in profiler without selecting a node and
then pressing up or pgup, cursor_index was in an invalid state. Instead
select the first node in the index.
2021-06-05 11:27:05 +02:00
Tim Schumacher f295ac3c0b rm: Allow empty paths if -f is specified
On most (if not all) systems rm ignores an empty paths array if -f or
--force is specified. This helps with scripts that may pass an empty
variable where the file paths are supposed to go.
2021-06-05 10:56:58 +02:00
Gunnar Beutner aec941b46c Ports: Add port for freeciv 2021-06-05 10:56:37 +02:00
Gunnar Beutner 4cd45f5875 LibC: Let setlocale() pretend that setting the locale succeeded
By returning nullptr we're telling the caller that setlocale() failed.
Some programs expect setlocale() to succeed so let's pretend that it
did.
2021-06-05 10:56:37 +02:00
Gunnar Beutner 431bed5158 Ports: Specify missing library when linking SDL2_ttf 2021-06-05 10:56:37 +02:00
Gunnar Beutner 7e1f413a89 Ports: Build shared library for freetype 2021-06-05 10:56:37 +02:00
yegor 6f0092edb8 Ports: fix gcc for mac users
BSD sed differs from GNU sed with the `-i` option.
This commit changes the sed line in package.sh to be
portable across macOS and Linux.
2021-06-05 10:56:04 +02:00
Max Wipfli 2164d8aae8 AK: Stop using U+0000 as end of file code point in URL parser
This changes URL parser to use the 0xFFFFFFFF constant instead of 0 to
indicate end of file. This fixes a bug where inputs containing null
bytes would terminate the parser early, because they were interpreted
as end of file.
2021-06-05 10:53:31 +02:00
Max Wipfli 97425c7dfb AK: Make debugging URLParser easier
This patch adds a state_name method to URLParser to convert a state to a
string. With this, the debugging statements now display the state names.

Furthermore, this fixes a bug where non-ASCII code points were
formatted as characters, which fails an assertion in the formatting
system.
2021-06-05 10:53:31 +02:00
Max Wipfli 99d5555134 AK: Do not trim away non-ASCII bytes when parsing URL
Because non-ASCII code points have negative byte values, trimming away
control characters requires checking for negative bytes values.

This also adds a test case with a URL containing non-ASCII code points.
2021-06-05 10:53:31 +02:00
Max Wipfli 44937e2dfc AK: Update URLParser.{cpp,h} to use east const 2021-06-05 10:53:31 +02:00
Idan Horowitz 0f8ed6183b LibJS: Add the Number.{MAX, MIN}_VALUE constants 2021-06-05 02:38:37 +01:00
Jelle Raaijmakers 3dab9d0b5c Kernel: Implement offset for lseek with SEEK_END 2021-06-04 23:49:48 +02:00
Timothy Flynn f73bb164ad LibCards: Draw card stack background when the entire stack is moving
The stack background should be painted when the entire stack is being
dragged, rather than just the top card.

Fixes #7786. Regressed in 2b762ef940.
2021-06-04 23:48:25 +02:00
Jelle Raaijmakers f6d372b2ab Kernel: Process::exec(): Check if path is a regular file
https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html

  [EACCES] The new process image file is not a regular file and the
           implementation does not support execution of files of its
           type.

Let's check whether the passed `path` is indeed a regular file.
2021-06-04 23:45:17 +02:00
Jelle Raaijmakers 9510425845 Shell: Add TMPDIR environment variable
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/
V1_chap08.html

  TMPDIR  This variable shall represent a pathname of a directory made
          available for programs that need a place to create temporary
          files.

Ports like PHP benefit from having this environment variable set, and
there exist a lot of scripts that assume the presence of such an
environment variable.
2021-06-04 23:44:59 +02:00
Gunnar Beutner a42383523a Kernel: Update the TX byte counter when sending network packets
This previously worked but was broken by b436dd1.
2021-06-05 00:36:55 +04:30
Max Wipfli ec2f0fc8eb LibCpp: Fix off-by-one error in SyntaxHighlighter
This changes the C++ SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

Contrary to other syntax highlighters, for this one the change has been
made to the SyntaxHighlighter rather than the Lexer. This is due to the
fact that the Parser also uses the same Lexer. I'm soure there is some
more elegant way to do this, but this patch at least unbreaks the C++
syntax highlighting.
2021-06-05 00:32:28 +04:30
Max Wipfli 617c54a00b LibCpp: Do not emit empty whitespace token after include statement
If an include statement didn't contain whitespace between the word
"include" and the '<' or '"', the lexer would previous emit an empty
whitespace token. This has been changed now.
2021-06-05 00:32:28 +04:30
Max Wipfli 2aa0cbaf22 LibCpp: Use CharacterTypes.h and constexpr functions in Lexer 2021-06-05 00:32:28 +04:30
Max Wipfli d57d7bea1c LibCpp: Use east const style in Lexer and SyntaxHighlighter 2021-06-05 00:32:28 +04:30
Max Wipfli 282a623853 LibWeb: Change a few source end positions in HTMLTokenizer
This patch aims to fix wrong highlighting for some cases in HTML's
syntax highlighter. The values were somewhat experimentally determined
are are subject to change. Regardless, it should be more correct with
this patch than without it. :^)
2021-06-05 00:32:28 +04:30
Max Wipfli 44c438d0ca LibWeb: Fix off-by-one error in SyntaxHighlighter
This changes the HTML SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor. It also
avoids emitting tokens if they have a zero or negative length.

This fixes a bug where single-character tokens were not highlighted
properly.
2021-06-05 00:32:28 +04:30
Max Wipfli 932161e581 LibWeb: Be more forgiving when adding source positions in HTMLTokenizer
This patch changes HTMLTokenizer::nth_last_position to not fail if the
requested position is not available. Rather, it will just return (0-0).

While this is not the correct solution, it prevents the tokenizer from
crashing just because it cannot find a source position. This should only
affect SyntaxHighlighter.
2021-06-05 00:32:28 +04:30
Max Wipfli 93d830b5cc LibWeb: Add debugging statements in SyntaxHighlighter
This also changes SyntaxHighlighter.{h,cpp} to use east const style.
2021-06-05 00:32:28 +04:30
Max Wipfli 04897f6842 LibSQL: Fix off-by-one error in SyntaxHighlighter
This changes the SQL SyntaxHighlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.
2021-06-05 00:32:28 +04:30
Max Wipfli a9378ce5c2 LibSQL: Clean up SyntaxHighlighter code
This changes SyntaxHighlighter.{cpp,h} to use east const style. It also
removes two unused headers and simplifies a loop.
2021-06-05 00:32:28 +04:30
Max Wipfli 261f233060 Shell: Fix off-by-one error in SyntaxHighlighter
This changes the Shell syntax highlighter to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

This also adds some debug output to make debugging easier.
2021-06-05 00:32:28 +04:30
Max Wipfli cb5a50d3f7 LibGUI: Fix off-by-one error in Lexer tokens
This changes the INI and GML lexers to conform to the now-fixed
rendering of syntax highlighting spans in GUI::TextEditor.

The other user of GMLToken::m_end, GMLAutocompleteProvider, has been
modified to take into account that end position columns have been
incremented by one.
2021-06-05 00:32:28 +04:30
Max Wipfli e7b5dbe1ac LibGUI: Use CharacterTypes.h and constexpr functions in {INI,GML}Lexer 2021-06-05 00:32:28 +04:30