Modern applications have lots of code. And the C++ language doesn't get easier. Nowadays, code reviews are not enough to fully analyze program code. Here's where static code analysis comes in.
All streams
- New
- Top
- All
- ≥0
- ≥10
- ≥25
- ≥50
- ≥100
Making an Encoder Cable for Servosila Brushless Motor Controller. Testing in Direct Drive mode
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/b8a/186/646/b8a186646f1a7c768a4a68f994121a21.png)
In this video, we are making a cable for connecting a quadrature encoder to a Servosila brushless motor controller, and and then running a servo motor in Direct Drive mode. To make the cable we are using a cable assembly kit that can be purchased from the internet store. Alternatively, the components for the cable can be bought in other places. The part numbers are given in the controller's datasheet.
The cable assembly kit consists of a connector and a set of wires with pre-crimped socket blades. If you have a crimper tool, you can also attach the socket blades to wires by yourself.
Lets open a datasheet document that comes with the brushless motor controller. Note that each connector has its first pin clearly marked with a "1" sign. Conventionally, the numbering of pins is done in such a way that there are rows of odd-numbered and even-numbered pins.
The quadrature encoder's electrical interface has 5 wires in total. Positions of the pins of each of the wires are given in the table. The socket blades need to be pushed into the connector until you feel a "click". The blades lock into the connector's sockets. Optionally, primarily for cosmetic reasons, you may want to add a heat-shrink tubing to your cable.
The brushless motor controllers come in two distinct forms, a circular and a rectangular one. Both models are identical in terms of capabilities, features, firmware, and external electrical connectors.
The connector has a locking mechanism that keeps it in place. I soldered a mating connector to the other side of the cable - a connector that my brushless motor needs. Note that your motor will likely require a different connector, or no connector at all. It is always a good idea to test an end-to-end integrity of the cable and its connectors. Lets buzz the wires using a multimeter. The cable is ready.
PVS-Studio 7.15: MISRA, CWE, OWASP, Unreal Engine
We are actively developing the PVS-Studio static analysis tool towards detecting Safety and Security-related errors. To be more precise, we've expanded the coverage of the MISRA C:2012 and OWASP ASVS standards. We have supported the MISRA Compliance 2020 standard. One of the more extraordinary innovations is the Best Warnings display mode. This mode displays the most significant (meaningful) warnings and can be useful when you are just starting out with the analyzer.
SEPIC-Ćuk split-rail converter average model
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/60f/cdd/0fe/60fcdd0fe2c5263badef7e4a3e1a0fe1.png)
SEPIC-Ćuk split-rail converter can be used to make positive and negative supplies from a single input voltage for relatively well-matched loads like operational amplifiers.
Transient models are time consuming. Average models reduce modeling time drastically.
The PWM switch average models for current- and voltage-mode are described in details in Christophe Basso’s book “Switch-Mode Power Supplies, Second Edition: SPICE Simulations and Practical Designs”. Using of these models for SEPIC and Ćuk converters is also shown.
This text shows how to use the PWM switch average model to design a split-rail SEPIC-Ćuk converter.
Detecting errors in the LLVM release 13.0.0
Commercial static analyzers perform deeper and fuller code analysis compared to compilers. Let's see what PVS-Studio found in the source code of the LLVM 13.0.0 project.
We have published a model for text repunctuation and recapitalization for four languages
Working with speech recognition models we often encounter misconceptions among potential customers and users (mostly related to the fact that people have a hard time distinguishing substance over form). People also tend to believe that punctuation marks and spaces are somehow obviously present in spoken speech, when in fact real spoken speech and written speech are entirely different beasts.
Of course you can just start each sentence with a capital letter and put a full stop at the end. But it is preferable to have some relatively simple and universal solution for "restoring" punctuation marks and capital letters in sentences that our speech recognition system generates. And it would be really nice if such a system worked with any texts in general.
For this reason, we would like to share a system that:
- Inserts capital letters and basic punctuation marks (dot, comma, hyphen, question mark, exclamation mark, dash for Russian);
- Works for 4 languages (Russian, English, German, Spanish) and can be extended;
- By design is domain agnostic and is not based on any hard-coded rules;
- Has non-trivial metrics and succeeds in the task of improving text readability;
To reiterate — the purpose of such a system is only to improve the readability of the text. It does not add information to the text that did not originally exist.
Helpful service for microservice JSON-RPC based test automation
Test automation, with product built in microservice architecture could be very situational in context of testing goals and ways to achieve them. You got an easy life if you testing a service, that is an isolated entity, which is receiving some data and providing a result of it's work in a response, by callback or through additional endpoint. In this case all you need to do is cover all the endpoints of the service, and probably learn to catch it's callbacks. However, it's not the only case. Sometimes you need to test service which isn't totally isolated, but a part of a chain of interactions. This service could send some data to other services within your infrastructure or even to third parties. This time you got plenty of additional things to bother of:
How to fund an MVP-stage startup? An ultimate guide to initial funding
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/b47/0b8/360/b470b836013673993d813978c0aed51e.jpeg)
Free money to fund your own business is probably the most cherished dream of every budding entrepreneur.
And getting a grant is what can bring it to life. While small business owners dream of a grant to fund their startup, the process of its obtaining is not as easy and cloudless as it may seem.
However, if you know where to look for the right fund and how to apply, one can significantly nick in the path to getting seed money.
Difference between a grant, attracted investment, and loan.
Millions of orders per second matching engine testing
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/751/c03/16d/751c0316d8ce9b5ddc15748e3d418eeb.jpg)
I had some experience in the matching engine development for cryptocurrency exchange some time ago. That was an interesting and challenging experience. I developed it in clear C++ from scratch. The testing of it is also quite a challenging task. You need to get data for testing, perform testing, collect some statistics, and at last, analyze collected data to find weak points and bottlenecks. I want to focus on testing the C++ matching engine and show how testing can give insights for optimizations even without the need to change the code. The matching engine I developed can do more than 1’000’000 TPS (transactions per second) and is 10x times faster than the matching engine of the Binance cryptocurrency exchange (see one post on Binance Blog).
PIM or MDM: which system is better for retail?
Effective data management is a critical aspect in retail. You have to manage information about customers, products, services, staff, materials, and so on. You should have a source that you will trust. And you need to store, process, moderate, and administer data in this system.
Until recently, retailers only knew MDM - Master Data Management. A traditional MDM system is a system that knows about different data sources. It contains the “golden standard” of data.
Imagine that your stores have one customer information, your online store has another, and your marketing services have third data. MDM system collects all these types of information in a single source. The system can find the same clients, spelled differently, and eliminate errors in the data based on different algorithms.
The evolution of MDM systems has led to the emergence of highly specialized master systems. Modern business does not need to implement a heavy MDM to manage only product data. There are PIM systems for this task.
Software testers — an endangered species?
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/c7e/fc3/f5c/c7efc3f5c309f87d173c02cea1e32982.png)
Nothing and nobody will escape oblivion. Whatever you may say, the history of mankind is a history of automation and the subsequent evolution of workers. This happened both during the first industrial revolution and during the second. The same thing happened with digital revolution. Now machine learning and artificial intelligence are being implemented everywhere. What is the future of software testing?
CWE Top 25 2021. What is it, what is it for and how is it useful for static analysis?
For the first time PVS-Studio provided support for the CWE classification in the 6.21 release. It took place on January 15, 2018. Years have passed since then and we would like to tell you about the improvements related to the support of this classification in the latest analyzer version.
Big Data Tools with IntelliJ IDEA Ultimate, PyCharm Professional, DataGrip 2021.3 EAP, and DataSpell Support
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/918/e06/902/918e069020ce32f06f266386b4179dde.png)
Recently we released a new build of the Big Data Tools plugin that is compatible with the 2021.3 versions of IntelliJ IDEA and PyCharm. DataGrip 2021.3 support will be available immediately after the release in October. The plugin also supports our new data science IDE – JetBrains DataSpell. If you still use previous versions, now is the perfect time to upgrade both your IDE and the plugin.
This year, we introduced a number of new features as well as some features that have been there for a while, for example, running Spark Submit with a run configuration.
Here’s a list of the key improvements:
How malware gets into the App Store and why Apple can't stop that
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/3a2/ba5/669/3a2ba566997c46b24c2748e6ba0ac430.jpg)
Only after I had published a post detailing three iOS 0-day vulnerabilities and expressing my frustration with Apple Security Bounty Program, I received a reply from Apple:
We saw your blog post regarding this issue and your other reports.
We apologize for the delay in responding to you. We want to let you know that we are still investigating these issues and how we can address them to protect customers. Thank you again for taking the time to report these issues to us, we appreciate your assistance.
Please let us know if you have any questions.
Indeed, I do have questions. The same ones that you have ignored. I'm gonna repeat them. Why was the fix for analyticsd vulnerability quietly included in iOS 14.7 update but not mentioned on its security content list? Why did you promise to include it in the next update's list but broke your words not once but trice? Why do you keep ignoring these questions?
After my previous post, some people have expressed doubts that such code can make its way into the App Store. It's understandable why they think this way. That's because Apple makes people believe that the App Store is safe by repeating it over and over. Moreover, they claim that they disallow alternative stores and application sideloading to keep users safe and otherwise they would be in great danger. Android has alternative stores and unrestricted sideloading, and have you heard about any kind of security problems with Android recently? I haven't. But it the last few months alone there were so many reports about security and privacy issues on Apple platforms. And the real reason that Apple doesn't allow any alternatives to the App Store is that they receive 30% commission on all purchases made inside any app and it's a tremendously lucrative business for them. They also enact censorship by choosing to allow or disallow any app into the App Store based purely on subjective opinions of their employees and managers.
So in this article I'm going to dispute the claim that the App Store is safe, voice my complaints about the App Store review process and provide a detailed explanation (including source code) how malicious apps on the App Store conceal their functionality from the App Store review team and are able to sneak into the App Store.
Why we need dynamic code analysis: the example of the PVS-Studio project
In May 2021, CppCast recorded a podcast called ABI stability (CppCast #300). In this podcast, Marshall Clow and the hosts discussed rather old news — Visual Studio compilers support the AddressSantitzer tool. We have already integrated ASan into our testing system a long time ago. Now we want to tell you about a couple of interesting errors it found.
Difficulties You Might Encounter When Using vue-i18n
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/02f/446/071/02f446071f1fcc15bc89e400e845262a.jpeg)
After few months of frustration with trying to use the "de-facto" internationalization library for Vue.js - vue-i18n
, I've decided it is time to replace it. And that is why I have created fluent-vue
- a Vue.js internationalization plugin that uses Mozilla's Fluent syntax to allow for natural-sounding translations.
In this post, I try to explain what problems I have encountered when trying to use vue-i18n
library in my app, and how Fluent syntax solves them.
Creating Roslyn API-based static analyzer for C#
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/616/a42/a33/616a42a33c69f03f580690b651bce761.png)
After you read this article, you'll have the knowledge to create your own static analyzer for C#. With the help of the analyzer, you can find potential errors and vulnerabilities in the source code of your own and other projects. Are you intrigued? Well, let's get started.
Disclosure of three 0-day iOS vulnerabilities and critique of Apple Security Bounty program
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/5b4/f38/55e/5b4f3855ed7e33970065a5606df6a14b.jpg)
I want to share my frustrating experience participating in Apple Security Bounty program. I've reported four 0-day vulnerabilities this year between March 10 and May 4, as of now three of them are still present in the latest iOS version (15.0) and one was fixed in 14.7, but Apple decided to cover it up and not list it on the security content page. When I confronted them, they apologized, assured me it happened due to a processing issue and promised to list it on the security content page of the next update. There were three releases since then and they broke their promise each time.
Read more to learn the specifics of 0-day vulnerabilities.
Insights Into Proactive Threat Hunting
![](https://webcf.waybackmachine.org/web/20211014143003im_/https://habrastorage.org/getpro/habr/upload_files/f71/cb7/fe4/f71cb7fe47db37783c79ebd97bd95465.jpg)
Proactive search for complex threats seems to be a useful technology but inaccessible for many organizations. Is it really so? What do companies need to do to start Threat Hunting? What tools are needed for threat hunting? What trends in this area can be seen on the market in the coming years? These are some of the questions I would like to answer in my article today.
What is Threat Hunting?
Threat Hunting is a search for threats in a proactive mode when the information security specialist is sure that the network is compromised. He should understand how his network operates in order to be able to identify various attacks by examining the existing anomalies.
Threat Hunting is a search for threats that have already bypassed automated detection systems. Moreover, most often, you do not have signals or alerts that allow you to detect an intrusion.
From the SOC perspective, Threat Hunting is an extension of the service that allows you to counter any level of intruders, including those who use previously unknown tools and methods.
Threat Hunting can be based on some data obtained by a security specialist, or it can be based on a hypothesis. If after testing the hypothesis, the test gives a positive result, then later, it can be used to improve the processes and mechanisms of detecting threats. And also, Threat Hunting allows you to find blind spots in the security system and expand the monitoring area.
What organizations need Threat Hunting?
Proactive threat hunting is relevant to those organizations that can become the target of a complex, targeted APT attack. At the same time, given the trend towards supply chain attacks, a small company may also become a target for motivated attackers.
MISRA C: struggle for code quality and security
A couple of years ago the PVS-Studio analyzer got its first diagnostic rules to check program code compliance with the MISRA C and MISRA C++ standards. We collected feedback and saw that our clients were interested in using the analyzer to check their projects for MISRA compliance. So, we decided to further develop the analyzer in this direction. The article covers the MISRA C/C++ standard and the MISRA Compliance report. It also shows what we already managed to do and what we plan to achieve by the end of the year.