You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2021/04/20 16:06:00 UTC

[GitHub] [mynewt-core] kasjer opened a new pull request #2573: ctype: Fix undefined behavior in ctype.h usage

kasjer opened a new pull request #2573:
URL: https://github.com/apache/mynewt-core/pull/2573


   Although ctype.h functions/macros like isalpha, isdigit etc.
   take int argument as input behaviour is undefined if value
   passed to those are not from unsigned char + EOF.
   If the implementation choose to use simple macro that accesses
   table indexed by argument and it was negative as it can be
   when char is cast to int (as was the case in some places)
   result would be unpredictable.
   In most cases argument to ctype define functions was correctly
   cast to unsigned (json/lwip and many other places).
   
   This updates places that could be prone to this problem with
   cast to (unsigned char).
   For baselibc implementation it does not make difference but
   if some other libc was chosen it could lead to potential
   problems (warnings at build time or unpredictable behavior).
   
   Problem was observed when gcc provided ctype.h was used
   instead of baselibc one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2573: ctype: Fix undefined behavior in ctype.h usage

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2573:
URL: https://github.com/apache/mynewt-core/pull/2573#issuecomment-823418964


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/full/history_log/src/history_log.c
   <details>
   
   ```diff
   @@ -142,7 +146,8 @@
        /* Trim from spaces */
        while (isspace((unsigned char)*line)) {
            line++;
   -    };
   +    }
   +    ;
    
        len = strlen(line);
        if (len == 0) {
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot removed a comment on pull request #2573: ctype: Fix undefined behavior in ctype.h usage

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #2573:
URL: https://github.com/apache/mynewt-core/pull/2573#issuecomment-823418964


   
   <!-- style-bot -->
   
   ## Style check summary
   
   ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
   
   
   #### sys/console/full/history_log/src/history_log.c
   <details>
   
   ```diff
   @@ -142,7 +146,8 @@
        /* Trim from spaces */
        while (isspace((unsigned char)*line)) {
            line++;
   -    };
   +    }
   +    ;
    
        len = strlen(line);
        if (len == 0) {
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] kasjer merged pull request #2573: ctype: Fix undefined behavior in ctype.h usage

Posted by GitBox <gi...@apache.org>.
kasjer merged pull request #2573:
URL: https://github.com/apache/mynewt-core/pull/2573


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [mynewt-core] apache-mynewt-bot commented on pull request #2573: ctype: Fix undefined behavior in ctype.h usage

Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #2573:
URL: https://github.com/apache/mynewt-core/pull/2573#issuecomment-823493291


   
   <!-- style-bot -->
   
   ## Style check summary
   
   #### No suggestions at this time!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org