Code Monkey home page Code Monkey logo

v_escape's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar renovate[bot] avatar tizgafa avatar tshepang avatar zzau13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

v_escape's Issues

Escaping don't working

image

Ok(ProductState {
        stock: escape(&stock).to_string(),
        price: escape(&price).to_string(),
    })

I'm doing something wrong ?

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

error: failed to parse manifest at `/home/dependabot/dependabot-updater/dependabot_tmp_dir/v_latexescape/Cargo.toml`

Caused by:
  Expected dot for key `package.version`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Out of bounds read in implementation using SSE

In escape, when there is still some data remaining but less than M128_VECTOR_SIZE, the implementation continues to use _mm_load_si128 which reads memory out of bounds of the original byte slice. This is undefined behaviour at Rust language level. The issue can be detected with AddressSanitizer or valgrind --tool=memcheck --partial-loads-ok=no.

https://github.com/botika/v_escape/blob/f1a65cb650122c662d7fa0e92a0bacf4badf7208/v_escape/src/sse.rs#L112-L121

Minimal reproducer below (the mileage might vary, depending on actual alignment used for string slice):

fn main() {
  println!("{}", v_htmlescape::escape(&"abcdefghijklmnopq".to_owned()));
}

Can SIGILL if compile with cpu features and execute without it

At b_escape function can produce SIGILL cpu exception.

If you compile in to target_arch x86_64 and target_feature avx2 and sse2, you will be forced to execute this function in a cpu with the previous characteristics. In any other way it will produce this exception

There is no cheap way to implement runtime detection until rust-lang/rust#57775 is resolved.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `v_escape = "^0.7"`
  candidate versions found which didn't match: 0.8.0
  location searched: /home/dependabot/dependabot-updater/dependabot_tmp_dir/v_escape
required by package `v_htmlescape v0.5.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/v_htmlescape)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Can't be used on ARM platform because of error 'is_x86_feature_detected can only be used on x86 and x86_64 targets'

Trying to build project for ARM (both aarch64and armv7hf) platforms got an error. It seems there proposedaway to fix:

Compiling v_escape v0.12.0
error[E0658]: use of unstable library feature 'stdsimd'
 --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.12.0/build.rs:6:8
  |
6 |     if is_x86_feature_detected!("sse2") {
  |        ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information

error:
        is_x86_feature_detected can only be used on x86 and x86_64 targets.
        You can prevent it from being used in other architectures by
        guarding it behind a cfg(target_arch) as follows:

            #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
                if is_x86_feature_detected(...) { ... }
            }

 --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.12.0/build.rs:6:8
  |
6 |     if is_x86_feature_detected!("sse2") {
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: use of unstable library feature 'stdsimd'
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.12.0/build.rs:10:8
   |
10 |     if is_x86_feature_detected!("avx2") {
   |        ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #27731 <https://github.com/rust-lang/rust/issues/27731> for more information

error:
        is_x86_feature_detected can only be used on x86 and x86_64 targets.
        You can prevent it from being used in other architectures by
        guarding it behind a cfg(target_arch) as follows:

            #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
                if is_x86_feature_detected(...) { ... }
            }

  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.12.0/build.rs:10:8
   |
10 |     if is_x86_feature_detected!("avx2") {
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0658`.
error: could not compile `v_escape`.

To learn more, run the command again with --verbose.

Binary codegen

Refactor the constructor to reduce compilation times by generating the code and including it in the sources through a simple binary.
#76

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `v_escape = "~0.14.1"`
candidate versions found which didn't match: 0.15.0
location searched: /home/dependabot/dependabot-updater/dependabot_tmp_dir/v_escape
required by package `v_htmlescape v0.12.0 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/v_htmlescape)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Failed to compile

Compilation fails on Ubuntu 20.04 LTS, so I can't update the benchmark.

cc: rust-sailfish/sailfish#18.

Output:

   Compiling v_escape v0.10.0
error: no rules expected the token `if`
  --> /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_htmlescape-0.8.0/src/lib.rs:27:9
   |
27 | /         new_escape!(
28 | |             HTMLEscape,
29 | |             "60->&lt; || 62->&gt; || 38->&amp; || 34->&quot; || 39->&#x27; || 47->&#x2f;",
30 | |             simd = true, avx = true
31 | |         );
   | |__________^ no rules expected this token in macro call
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: no rules expected the token `if`
  --> /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_htmlescape-0.8.0/src/lib.rs:27:9
   |
27 | /         new_escape!(
28 | |             HTMLEscape,
29 | |             "60->&lt; || 62->&gt; || 38->&amp; || 34->&quot; || 39->&#x27; || 47->&#x2f;",
30 | |             simd = true, avx = true
31 | |         );
   | |__________^ no rules expected this token in macro call
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

error: could not compile `v_htmlescape`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
Full output with `-Z macro-backtrace` flag
   Compiling v_escape v0.10.0
error: no rules expected the token `if`
   --> /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.10.0/src/lib.rs:291:49
    |
165 | / macro_rules! new_escape {
166 | |     // Macro called without attributes
167 | |     ($name:ident, $pairs:expr) => {
168 | |         use std::fmt::{self, Display, Formatter};
...   |
186 | |         #[derive(Escape)]
    | |                  ------
    | |                  |
    | |                  in this macro invocation (#2)
    | |                  in this macro invocation (#3)
...   |
194 | |     };
195 | | }
    | |_- in this expansion of `new_escape!` (#1)
...
277 | / macro_rules! _v_escape_cfg_escape {
278 | |     (false, $($t:tt)+) => {
279 | |         _v_escape_cfg_escape!(fn);
280 | |     };
...   |
291 | |                 let fun = _v_escape_cfg_escape!(if $($t)+);
    | |                                                 ^^ no rules expected this token in macro call
...   |
333 | |     };
334 | | }
    | |_- in this expansion of `_v_escape_cfg_escape!` (#3)
    |
   ::: /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape_derive-0.7.0/src/lib.rs:14:1
    |
14  | / pub fn derive(input: TokenStream) -> TokenStream {
15  | |     let ast: &syn::DeriveInput = &syn::parse(input).unwrap();
16  | |     build(ast).parse().unwrap()
17  | | }
    | |_- in this expansion of `#[derive(Escape)]` (#2)
    |
   ::: /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_htmlescape-0.8.0/src/lib.rs:27:9
    |
27  | /         new_escape!(
28  | |             HTMLEscape,
29  | |             "60->&lt; || 62->&gt; || 38->&amp; || 34->&quot; || 39->&#x27; || 47->&#x2f;",
30  | |             simd = true, avx = true
31  | |         );
    | |__________- in this macro invocation (#1)

error: no rules expected the token `if`
   --> /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.10.0/src/lib.rs:354:53
    |
165 | / macro_rules! new_escape {
166 | |     // Macro called without attributes
167 | |     ($name:ident, $pairs:expr) => {
168 | |         use std::fmt::{self, Display, Formatter};
...   |
186 | |         #[derive(Escape)]
    | |                  ------
    | |                  |
    | |                  in this macro invocation (#2)
    | |                  in this macro invocation (#3)
...   |
194 | |     };
195 | | }
    | |_- in this expansion of `new_escape!` (#1)
...
339 | / macro_rules! _v_escape_cfg_escape_ptr {
340 | |     (false, $($t:tt)+) => {
341 | |         _v_escape_cfg_escape_ptr!(fn);
342 | |     };
...   |
354 | |                 let fun = _v_escape_cfg_escape_ptr!(if $($t)+);
    | |                                                     ^^ no rules expected this token in macro call
...   |
396 | |     };
397 | | }
    | |_- in this expansion of `_v_escape_cfg_escape_ptr!` (#3)
    |
   ::: /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape_derive-0.7.0/src/lib.rs:14:1
    |
14  | / pub fn derive(input: TokenStream) -> TokenStream {
15  | |     let ast: &syn::DeriveInput = &syn::parse(input).unwrap();
16  | |     build(ast).parse().unwrap()
17  | | }
    | |_- in this expansion of `#[derive(Escape)]` (#2)
    |
   ::: /home/kogia-sima/.cargo/registry/src/github.com-1ecc6299db9ec823/v_htmlescape-0.8.0/src/lib.rs:27:9
    |
27  | /         new_escape!(
28  | |             HTMLEscape,
29  | |             "60->&lt; || 62->&gt; || 38->&amp; || 34->&quot; || 39->&#x27; || 47->&#x2f;",
30  | |             simd = true, avx = true
31  | |         );
    | |__________- in this macro invocation (#1)

error: aborting due to 2 previous errors

error: could not compile `v_htmlescape`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Email template release

Hi, it's possible to get random render with yarte?.

I mean, i have a template with HTML and inline styles into it (it's for the email body), when I send the email on my development (debug) there is not problem with the email body (all is as expect it), when I build to production (release), sometimes the email body is printing some HTML code as text (not all code but some pieces), or sometimes, (with a new build) loses the inline styles with all body text as expect it (without some HTML code as text)

How can I fix a compile error?

One of the packages I need requires v_escape_derive-0.2.1 and when I run cargo build I receive the following message:

error[E0658]: use of extern prelude names introduced with extern crate items is unstable (see issue #55599)
--> /Users//.cargo/registry/src/github.com-/v_escape_derive-0.2.1/src/lib.rs:7:5
|
7 | use proc_macro::TokenStream;
| ^^^^^^^^^^
|
= help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try rustc --explain E0658.
error: Could not compile v_escape_derive.

Is there a way to fix it?

Segfault on Linux & Mac

Hi,

I have switched Tera to v_htmlescape and the tests there are all working fine but updating Zola to use the latest Tera with v_htmlescape segfaults in some cases.

Running with valgrind -v gives:

==15212== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==15212==  Access not within mapped region at address 0x1
==15212==    at 0x483EA10: memmove (vg_replace_strmem.c:1270)
==15212==    by 0x1D035D7: core::coresimd::x86::avx::_mm256_loadu_si256 (avx.rs:1758)
==15212==    by 0x1CF7DC1: v_htmlescape::avx::escape (<::v_escape::avx::_v_escape_escape_avx macros>:26)
==15212==    by 0x1CF7CA2: _escape (<::v_escape::_v_escape_cfg_escape macros>:19)
==15212==    by 0x1CF7CA2: <v_htmlescape::HTMLEscape<'a> as core::fmt::Display>::fmt (<::v_escape::_v_escape_escape_new macros>:8)
==15212==    by 0x15C3C20: <&T as core::fmt::Display>::fmt (mod.rs:1914)
==15212==    by 0x2317EE1: run (mod.rs:1102)
==15212==    by 0x2317EE1: core::fmt::write (mod.rs:1049)
==15212==    by 0x2216477: core::fmt::Write::write_fmt (mod.rs:226)
==15212==    by 0x15C42FF: <T as alloc::string::ToString>::to_string (string.rs:2160)
==15212==    by 0x17280CA: tera::utils::escape_html (utils.rs:22)
==15212==    by 0x16E11F1: tera::renderer::processor::Processor::eval_expression (processor.rs:378)
==15212==    by 0x16EBEBD: tera::renderer::processor::Processor::render_node (processor.rs:780)
==15212==    by 0x16DC264: tera::renderer::processor::Processor::render_body (processor.rs:150)

If i override the Tera dependency on Zola to use a local version that doesn't use v_htmlescape, it works correctly.
I thought it was my computer at first since I am getting some weird memory errors these days but looking at CI, it didn't crash on Windows: https://ci.appveyor.com/project/Keats/zola/builds/21838732/job/kuwu8jsgm5rcfj74 but did on Linux https://travis-ci.com/getzola/zola/jobs/172488962 and Mac: https://travis-ci.com/getzola/zola/jobs/172488963

You can grab this commit getzola/zola@1e2dd9c to have a reproducible crash (at least on my machine & Travis)

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `v_escape = "^0.13"`
candidate versions found which didn't match: 0.14.0
location searched: /home/dependabot/dependabot-updater/dependabot_tmp_dir/v_escape
required by package `v_htmlescape v0.10.4 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/v_htmlescape)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

0.15.1 compilation error: call to unsafe function is unsafe and requires unsafe function or block

Just updated to version 0.15.1 and can no longer compile due to error:

error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
 --> .../.cargo/registry/src/github.com-1ecc6299db9ec823/v_htmlescape-0.15.1/src/lib.rs:1462:5
     |
1462 |     scalar::escape(bytes, fmt)
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
     |
     = note: consult the function's documentation for information on how to avoid undefined behavior

Derive implemented by backtracking

Build mask constructor by constraint punctuated over operations and false positive.

N is only 128. Define groups for operations by bits difference or ranges or both.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
benches/Cargo.toml
  • cfg-if 1.0
  • criterion 0.5
codegen/Cargo.toml
  • syn 2.0
  • quote 1.0
  • proc-macro2 1.0.81
  • clap 4.0
  • toml 0.8.12
  • serde 1.0
  • prettyplease 0.2
  • heck 0.5
v_htmlescape/Cargo.toml
  • buf-min 0.7
v_htmlescape/fuzz/Cargo.toml
  • libfuzzer-sys 0.4
  • bytes 1.3.0
v_jsonescape/Cargo.toml
  • buf-min 0.7
v_jsonescape/fuzz/Cargo.toml
  • libfuzzer-sys 0.4
  • bytes 1.3.0
v_latexescape/Cargo.toml
  • buf-min 0.7
v_latexescape/fuzz/Cargo.toml
  • libfuzzer-sys 0.4
  • bytes 1.3.0
github-actions
.github/workflows/checks.yml
  • actions/checkout v4
  • actions-rs/toolchain v1
  • actions-rs/cargo v1
.github/workflows/linux.yml
  • actions-rs/toolchain v1
  • actions-rs/cargo v1
  • actions/cache v4
  • actions/cache v4
  • actions-rs/cargo v1
.github/workflows/osx.yml
  • actions-rs/toolchain v1
  • actions-rs/cargo v1
  • actions/cache v4
  • actions/cache v4
  • actions-rs/cargo v1

  • Check this box to trigger a request for Renovate to run again on this repository

Consider implementing Askama's `Escaper` trait

That would make this crate very plug-and-play with the new escaping configuration in Askama, and I could mention this crate as an alternative for better performance or other formats in Askama's release notes.

New write in pointer implementation

I have to skip all the mechanisms to make the code 100% secure and replace them by hand with the minimum to avoid invalid pointer and buffer overruns. Only need return error before this 2 behaviors and adapt yarte for mitigate the rest of unexpected behaviors

v_escape(bytes: &[u8], buf: &mut [u8])-> Option<usize>

v_escape specifies too low minimum version of v_escape_derive

I'm having a bit of a problem with my minimum dependency version check in CI right now.

This issue originates here, as far as I can tell:
https://github.com/botika/v_escape/blob/97bc582df8dafd3316a8b780f18281a0dcd16ba4/v_escape/Cargo.toml#L23

I don't know where exactly the breaking change happened, but after cargo +nightly update -Z minimal-versions, my build fails as follows:

cargo +nightly check --lib --all-features
[…]
   Compiling v_escape v0.14.0
[…]
   Compiling v_escape_derive v0.8.1
[…]
error[E0432]: unresolved import `v_escape_derive::derive`
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.14.0/src/lib.rs:96:9
   |
96 | pub use v_escape_derive::derive;
   |         ^^^^^^^^^^^^^^^^^^^^^^^ no `derive` in the root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `v_escape`
Full build log excerpt
Run cargo +nightly check --lib --all-features
  cargo +nightly check --lib --all-features
  shell: /bin/bash -e {0}
 Downloading crates ...
  Downloaded derivative v2.1.1
  Downloaded bytes v0.6.0
  Downloaded v_escape v0.14.0
  Downloaded v_htmlescape v0.11.0
  Downloaded unicode-xid v0.2.0
  Downloaded lignin v0.0.2
  Downloaded cfg-if v1.0.0
  Downloaded buf-min v0.2.0
  Downloaded bumpalo v3.2.1
  Downloaded quote v1.0.0
  Downloaded memchr v2.3.0
  Downloaded syn v1.0.3
  Downloaded v_escape_derive v0.8.1
  Downloaded nom v4.0.0
  Downloaded proc-macro2 v1.0.0
   Compiling proc-macro2 v1.0.0
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.3
   Compiling memchr v2.3.0
    Checking bytes v0.6.0
   Compiling v_escape v0.14.0
   Compiling v_htmlescape v0.11.0
    Checking cfg-if v1.0.0
    Checking bumpalo v3.2.1
    Checking buf-min v0.2.0
   Compiling nom v4.0.0
   Compiling quote v1.0.0
   Compiling v_escape_derive v0.8.1
   Compiling derivative v2.1.1
error[E0432]: unresolved import `v_escape_derive::derive`
  --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/v_escape-0.14.0/src/lib.rs:96:9
   |
96 | pub use v_escape_derive::derive;
   |         ^^^^^^^^^^^^^^^^^^^^^^^ no `derive` in the root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `v_escape`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
Error: Process completed with exit code 101.

The build succeeds if v_escape_derive is allowed to resolve to v0.8.4.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `v_escape = "^0.13"`
candidate versions found which didn't match: 0.14.0
location searched: /home/dependabot/dependabot-updater/dependabot_tmp_dir/v_escape
required by package `v_htmlescape v0.10.4 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/v_htmlescape)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.