public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>, pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [RFC proxmox] support quoted strings in property strings
Date: Fri, 18 Feb 2022 09:13:45 +0100 (CET)	[thread overview]
Message-ID: <955923890.1230.1645172025768@webmail.proxmox.com> (raw)


> On 02/18/2022 9:02 AM Fabian Ebner <f.ebner@proxmox.com> wrote:
> 
>  
> > +fn parse_quoted_string<'s>(data: &'_ mut &'s str) -> Result<Cow<'s, str>, Error> {
> > +    let data_out = data;
> > +    let data = data_out.as_bytes();
> > +
> > +    if data[0] != b'"' {
> > +        bail!("not a quoted string");
> > +    }
> > +
> > +    let mut i = 1;
> > +    while i != data.len() {
> > +        if data[i] == b'"' {
> 
> What if a byte that's part of an UTF-8 character is equal to b'"', or
> can that not happen?

This cannot happen as then utf-8 wouldn't be ascii compatible.
In multibyte characters each byte has the high bit set and the first byte's
number of set high bits before the first zero bit tells you the length of the
sequence.
If that length were to cover a b'"' byte then the string was invalid to begin
with, which is not our fault.




             reply	other threads:[~2022-02-18  8:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18  8:13 Wolfgang Bumiller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-16 13:39 Wolfgang Bumiller
2022-02-17  8:58 ` Fabian Ebner
2022-02-17  9:47   ` Wolfgang Bumiller
2022-02-18  8:02 ` Fabian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=955923890.1230.1645172025768@webmail.proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal