Skip to content

Segfault with ^ (caret) operator with string and UInt of value zero. #35578

@Demonstrandum

Description

@Demonstrandum

System & Version

uname:

Arch Linux 4.19.91-lts x86_64 GNU/Linux

versioninfo():

Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)

Bug

When I try to apply ^ to a string more than one character long with an unsigned integer with value 0 (when trying to duplicate the string n (zero) times), it segfaults.

julia> "xx" ^ Int(0)    # works
""
julia> "xx" ^ UInt(2)   # works
"xxxx"
julia> "x" ^ UInt(0)    # works
""
julia> "xx" ^ UInt(0)   # segfaults

signal (11): Segmentation fault
in expression starting at REPL[3]:0
unknown function (ip: 0x7f7df8c8d369)
unknown function (ip: 0x7f7df8eb8b0a)
unknown function (ip: 0x7f7df8eb8ef4)
unknown function (ip: 0x7f7e05c9b439)
unknown function (ip: (nil))
Allocations: 962253 (Pool: 961928; Big: 325); GC: 1
[1]    96359 segmentation fault (core dumped)  julia

# Expected:
""

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorstrings"Strings!"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions